From 2633496da552233b48eeacf421658c69e563c98d Mon Sep 17 00:00:00 2001 From: William Howe-Lott Date: Wed, 15 Oct 2025 22:16:16 -0700 Subject: [PATCH 1/3] scrollable_overflow WIP snapshot --- scripts/gentest/src/main.rs | 102 +- src/compute/block.rs | 152 +- src/compute/common/content_size.rs | 108 +- src/compute/common/mod.rs | 30 + src/compute/flexbox.rs | 214 +- src/compute/grid/alignment.rs | 50 +- src/compute/grid/mod.rs | 64 +- src/compute/leaf.rs | 33 +- src/compute/mod.rs | 41 +- src/geometry.rs | 246 +- src/tree/layout.rs | 85 +- src/util/print.rs | 46 +- .../block/block_absolute_overflow_clip.html | 18 + .../block/block_absolute_overflow_hidden.html | 18 + .../block/block_absolute_overflow_scroll.html | 18 + .../block_absolute_overflow_visible.html | 18 + .../block/block_inflow_overflow_clip.html | 18 + .../block/block_inflow_overflow_hidden.html | 18 + .../block/block_inflow_overflow_scroll.html | 18 + .../block/block_inflow_overflow_visible.html | 18 + .../flex/content_size_with_border.html | 36 + .../flex/flex_absolute_overflow_clip.html | 18 + .../flex/flex_absolute_overflow_hidden.html | 18 + .../flex/flex_absolute_overflow_scroll.html | 18 + .../flex/flex_absolute_overflow_visible.html | 18 + .../flex/flex_inflow_overflow_clip.html | 18 + .../flex/flex_inflow_overflow_hidden.html | 18 + .../flex/flex_inflow_overflow_scroll.html | 18 + .../flex/flex_inflow_overflow_visible.html | 18 + .../grid/grid_absolute_overflow_clip.html | 18 + .../grid/grid_absolute_overflow_hidden.html | 18 + .../grid/grid_absolute_overflow_scroll.html | 18 + .../grid/grid_absolute_overflow_visible.html | 18 + .../grid/grid_inflow_overflow_clip.html | 18 + .../grid/grid_inflow_overflow_hidden.html | 18 + .../grid/grid_inflow_overflow_scroll.html | 18 + .../grid/grid_inflow_overflow_visible.html | 18 + test_fixtures/leaf/leaf_overflow_clip.html | 17 + .../leaf/leaf_overflow_clip_with_border.html | 17 + ...overflow_clip_with_border_and_padding.html | 17 + .../leaf/leaf_overflow_clip_with_padding.html | 17 + test_fixtures/leaf/leaf_overflow_hidden.html | 17 + .../leaf_overflow_hidden_with_border.html | 17 + ...erflow_hidden_with_border_and_padding.html | 17 + .../leaf_overflow_hidden_with_padding.html | 17 + test_fixtures/leaf/leaf_overflow_scroll.html | 17 + .../leaf_overflow_scroll_with_border.html | 17 + ...erflow_scroll_with_border_and_padding.html | 17 + .../leaf_overflow_scroll_with_padding.html | 17 + test_fixtures/leaf/leaf_overflow_visible.html | 17 + .../leaf_overflow_visible_with_border.html | 17 + ...rflow_visible_with_border_and_padding.html | 17 + .../leaf_overflow_visible_with_padding.html | 17 + ...ct_ratio_overrides_height_of_full_inset.rs | 188 +- ...block_absolute_aspect_ratio_fill_height.rs | 176 +- ...ute_aspect_ratio_fill_height_from_inset.rs | 188 +- ...k_absolute_aspect_ratio_fill_max_height.rs | 190 +- ...ck_absolute_aspect_ratio_fill_max_width.rs | 190 +- ...k_absolute_aspect_ratio_fill_min_height.rs | 176 +- ...ck_absolute_aspect_ratio_fill_min_width.rs | 176 +- .../block_absolute_aspect_ratio_fill_width.rs | 176 +- ...lute_aspect_ratio_fill_width_from_inset.rs | 176 +- ...ute_aspect_ratio_height_overrides_inset.rs | 176 +- ...lute_aspect_ratio_width_overrides_inset.rs | 176 +- .../block_absolute_child_with_margin_x.rs | 348 ++- .../block_absolute_child_with_margin_y.rs | 348 ++- .../block_absolute_child_with_max_height.rs | 286 ++- .../block_absolute_layout_child_order.rs | 348 ++- .../block/block_absolute_layout_no_size.rs | 176 +- ...ercentage_bottom_based_on_parent_height.rs | 360 ++- ...block_absolute_layout_percentage_height.rs | 176 +- ...lute_layout_row_width_height_end_bottom.rs | 176 +- ...ck_absolute_layout_start_top_end_bottom.rs | 176 +- ...absolute_layout_width_height_end_bottom.rs | 176 +- ..._absolute_layout_width_height_start_top.rs | 176 +- ...ayout_width_height_start_top_end_bottom.rs | 176 +- .../block_absolute_layout_within_border.rs | 434 +++- ...e_margin_auto_bottom_and_top_with_inset.rs | 176 +- ...argin_auto_bottom_and_top_without_inset.rs | 176 +- ..._absolute_margin_auto_bottom_with_inset.rs | 176 +- ...solute_margin_auto_bottom_without_inset.rs | 176 +- ...e_margin_auto_left_and_right_with_inset.rs | 176 +- ...argin_auto_left_and_right_without_inset.rs | 176 +- ...eft_child_bigger_than_parent_with_inset.rs | 176 +- ..._child_bigger_than_parent_without_inset.rs | 176 +- ...ght_child_bigger_than_parent_with_inset.rs | 176 +- ..._child_bigger_than_parent_without_inset.rs | 176 +- ...ght_child_bigger_than_parent_with_inset.rs | 176 +- ..._child_bigger_than_parent_without_inset.rs | 176 +- ...ck_absolute_margin_auto_left_with_inset.rs | 176 +- ...absolute_margin_auto_left_without_inset.rs | 176 +- ...argin_auto_multiple_children_with_inset.rs | 262 +- ...in_auto_multiple_children_without_inset.rs | 262 +- ...k_absolute_margin_auto_right_with_inset.rs | 176 +- ...bsolute_margin_auto_right_without_inset.rs | 176 +- ...ock_absolute_margin_auto_top_with_inset.rs | 176 +- ..._absolute_margin_auto_top_without_inset.rs | 176 +- ..._absolute_margin_bottom_left_with_inset.rs | 176 +- ...solute_margin_bottom_left_without_inset.rs | 176 +- .../block_absolute_minmax_bottom_right_max.rs | 176 +- ...ck_absolute_minmax_bottom_right_min_max.rs | 176 +- ...e_minmax_bottom_right_min_max_preferred.rs | 176 +- ...solute_minmax_top_left_bottom_right_max.rs | 176 +- ...te_minmax_top_left_bottom_right_min_max.rs | 176 +- .../block/block_absolute_no_styles.rs | 262 +- .../block/block_absolute_overflow_clip.rs | 289 +++ .../block/block_absolute_overflow_hidden.rs | 295 +++ .../block/block_absolute_overflow_scroll.rs | 295 +++ .../block/block_absolute_overflow_visible.rs | 285 +++ ...olute_padding_border_overrides_max_size.rs | 176 +- ..._absolute_padding_border_overrides_size.rs | 176 +- .../block/block_absolute_resolved_insets.rs | 1660 +++++++++++-- .../block/block_align_baseline_child.rs | 360 ++- .../block_align_baseline_child_margin.rs | 360 ++- ...ock_align_baseline_child_margin_percent.rs | 360 ++- .../block_align_baseline_child_padding.rs | 360 ++- .../block/block_align_baseline_child_top.rs | 360 ++- .../block/block_align_baseline_child_top2.rs | 360 ++- ...lock_align_baseline_double_nested_child.rs | 458 +++- .../block/block_aspect_ratio_fill_height.rs | 176 +- .../block_aspect_ratio_fill_max_height.rs | 205 +- .../block_aspect_ratio_fill_max_width.rs | 176 +- .../block_aspect_ratio_fill_min_height.rs | 176 +- .../block_aspect_ratio_fill_min_width.rs | 176 +- .../block/block_aspect_ratio_fill_width.rs | 176 +- tests/generated/block/block_basic.rs | 262 +- .../block/block_border_fixed_size.rs | 262 +- .../block/block_border_intrinsic_size.rs | 262 +- .../block_border_percentage_fixed_size.rs | 274 ++- .../block_border_percentage_intrinsic_size.rs | 274 ++- tests/generated/block/block_display_none.rs | 348 ++- .../block/block_display_none_with_child.rs | 434 +++- .../block/block_display_none_with_inset.rs | 262 +- .../block/block_display_none_with_margin.rs | 262 +- ...ock_display_none_with_position_absolute.rs | 176 +- .../block/block_inflow_overflow_clip.rs | 275 +++ .../block/block_inflow_overflow_hidden.rs | 281 +++ .../block/block_inflow_overflow_scroll.rs | 281 +++ .../block/block_inflow_overflow_visible.rs | 271 +++ tests/generated/block/block_inset_fixed.rs | 348 ++- .../generated/block/block_inset_percentage.rs | 348 ++- .../generated/block/block_intrinsic_width.rs | 262 +- tests/generated/block/block_item_max_width.rs | 262 +- ...lock_item_min_width_overrides_max_width.rs | 176 +- .../block/block_item_text_align_center.rs | 262 +- .../block/block_item_text_align_left.rs | 262 +- .../block/block_item_text_align_right.rs | 262 +- .../block/block_margin_auto_bottom.rs | 262 +- .../block/block_margin_auto_bottom_and_top.rs | 262 +- .../generated/block/block_margin_auto_left.rs | 262 +- .../block/block_margin_auto_left_and_right.rs | 262 +- ...gin_auto_left_and_right_with_auto_width.rs | 176 +- ...rgin_auto_left_child_bigger_than_parent.rs | 176 +- ...left_fix_right_child_bigger_than_parent.rs | 176 +- ...uto_left_right_child_bigger_than_parent.rs | 176 +- .../block_margin_auto_multiple_children.rs | 348 ++- .../block/block_margin_auto_right.rs | 262 +- .../generated/block/block_margin_auto_top.rs | 262 +- .../block/block_margin_x_fixed_auto_bottom.rs | 262 +- .../block/block_margin_x_fixed_auto_left.rs | 262 +- ...lock_margin_x_fixed_auto_left_and_right.rs | 262 +- .../block/block_margin_x_fixed_auto_right.rs | 262 +- .../block/block_margin_x_fixed_auto_top.rs | 262 +- .../block_margin_x_fixed_size_negative.rs | 262 +- .../block_margin_x_fixed_size_positive.rs | 262 +- .../block_margin_x_intrinsic_size_negative.rs | 262 +- .../block_margin_x_intrinsic_size_positive.rs | 262 +- ...margin_x_percentage_fixed_size_negative.rs | 262 +- ...margin_x_percentage_fixed_size_positive.rs | 262 +- ...ercentage_intrinsic_size_other_negative.rs | 262 +- ...ercentage_intrinsic_size_other_positive.rs | 262 +- ...percentage_intrinsic_size_self_negative.rs | 176 +- ...percentage_intrinsic_size_self_positive.rs | 176 +- .../block/block_margin_y_collapse_complex.rs | 728 +++++- ...ollapse_through_blocked_by_aspect_ratio.rs | 348 ++- ...llapse_through_blocked_by_border_bottom.rs | 348 ++- ..._collapse_through_blocked_by_border_top.rs | 348 ++- ...in_y_collapse_through_blocked_by_height.rs | 348 ++- ..._y_collapse_through_blocked_by_line_box.rs | 348 ++- ...gh_blocked_by_line_box_with_height_zero.rs | 348 ++- ...locked_by_line_box_with_max_height_zero.rs | 348 ++- ..._collapse_through_blocked_by_min_height.rs | 348 ++- ...se_through_blocked_by_overflow_x_hidden.rs | 384 ++- ...se_through_blocked_by_overflow_x_scroll.rs | 384 ++- ...se_through_blocked_by_overflow_y_hidden.rs | 384 ++- ...se_through_blocked_by_overflow_y_scroll.rs | 384 ++- ...lapse_through_blocked_by_padding_bottom.rs | 348 ++- ...collapse_through_blocked_by_padding_top.rs | 348 ++- ...lock_margin_y_collapse_through_negative.rs | 348 ++- ...lock_margin_y_collapse_through_positive.rs | 348 ++- ..._collapse_through_positive_and_negative.rs | 348 ++- ..._y_collapse_through_with_absolute_child.rs | 446 +++- ...st_child_collapse_blocked_by_border_top.rs | 372 ++- ...d_collapse_blocked_by_overflow_x_hidden.rs | 408 +++- ...d_collapse_blocked_by_overflow_x_scroll.rs | 408 +++- ...d_collapse_blocked_by_overflow_y_hidden.rs | 408 +++- ...d_collapse_blocked_by_overflow_y_scroll.rs | 408 +++- ...t_child_collapse_blocked_by_padding_top.rs | 372 ++- ...n_y_first_child_collapse_negative_equal.rs | 372 ++- ...t_child_collapse_negative_parent_larger.rs | 372 ++- ..._child_collapse_negative_parent_smaller.rs | 372 ++- ...d_collapse_not_blocked_by_border_bottom.rs | 372 ++- ..._collapse_not_blocked_by_padding_bottom.rs | 372 ++- ...st_child_collapse_positive_and_negative.rs | 936 +++++++- ...n_y_first_child_collapse_positive_equal.rs | 372 ++- ...t_child_collapse_positive_parent_larger.rs | 372 ++- ..._child_collapse_positive_parent_smaller.rs | 372 ++- ...ranchild_collapse_positive_and_negative.rs | 1266 +++++++++- ...first_granchild_collapse_positive_equal.rs | 482 +++- ...child_collapse_blocked_by_border_bottom.rs | 372 ++- ...d_collapse_blocked_by_overflow_x_hidden.rs | 408 +++- ...d_collapse_blocked_by_overflow_x_scroll.rs | 408 +++- ...d_collapse_blocked_by_overflow_y_hidden.rs | 408 +++- ...d_collapse_blocked_by_overflow_y_scroll.rs | 408 +++- ...hild_collapse_blocked_by_padding_bottom.rs | 372 ++- ...in_y_last_child_collapse_negative_equal.rs | 372 ++- ...t_child_collapse_negative_parent_larger.rs | 372 ++- ..._child_collapse_negative_parent_smaller.rs | 372 ++- ...hild_collapse_not_blocked_by_border_top.rs | 372 ++- ...ild_collapse_not_blocked_by_padding_top.rs | 372 ++- ...st_child_collapse_positive_and_negative.rs | 936 +++++++- ...in_y_last_child_collapse_positive_equal.rs | 372 ++- ...t_child_collapse_positive_parent_larger.rs | 372 ++- ..._child_collapse_positive_parent_smaller.rs | 372 ++- ..._last_granchild_collapse_positive_equal.rs | 482 +++- ...lock_margin_y_sibling_collapse_negative.rs | 434 +++- ..._y_sibling_collapse_negative_percentage.rs | 434 +++- ...lock_margin_y_sibling_collapse_positive.rs | 434 +++- ..._sibling_collapse_positive_and_negative.rs | 692 +++++- ...llapse_positive_and_negative_percentage.rs | 692 +++++- ..._y_sibling_collapse_positive_percentage.rs | 434 +++- .../block/block_margin_y_simple_negative.rs | 262 +- ...rgin_y_simple_negative_percentage_other.rs | 262 +- ...argin_y_simple_negative_percentage_self.rs | 262 +- .../block/block_margin_y_simple_positive.rs | 262 +- ...rgin_y_simple_positive_percentage_other.rs | 262 +- ...argin_y_simple_positive_percentage_self.rs | 262 +- .../block/block_margin_y_total_collapse.rs | 458 +++- .../block_margin_y_total_collapse_complex.rs | 728 +++++- ...crollbars_overridden_by_available_space.rs | 290 ++- ...rflow_scrollbars_overridden_by_max_size.rs | 204 +- ..._overflow_scrollbars_overridden_by_size.rs | 204 +- ...flow_scrollbars_take_up_space_both_axis.rs | 204 +- ...low_scrollbars_take_up_space_cross_axis.rs | 204 +- ...flow_scrollbars_take_up_space_main_axis.rs | 204 +- .../block/block_padding_border_fixed_size.rs | 262 +- .../block_padding_border_intrinsic_size.rs | 262 +- ...block_padding_border_overrides_max_size.rs | 262 +- ...block_padding_border_overrides_min_size.rs | 262 +- .../block_padding_border_overrides_size.rs | 262 +- ...ck_padding_border_percentage_fixed_size.rs | 274 ++- ...adding_border_percentage_intrinsic_size.rs | 274 ++- .../block/block_padding_fixed_size.rs | 262 +- .../block/block_padding_intrinsic_size.rs | 262 +- .../block_padding_percentage_fixed_size.rs | 274 ++- ...block_padding_percentage_intrinsic_size.rs | 274 ++- tests/generated/block/mod.rs | 8 + .../blockflex_block_in_flex_column.rs | 262 +- .../blockflex/blockflex_block_in_flex_row.rs | 262 +- .../blockflex/blockflex_flex_in_block.rs | 360 ++- ...rgin_y_collapse_through_blocked_by_flex.rs | 348 ++- ..._y_first_child_collapse_blocked_by_flex.rs | 372 ++- ...n_y_last_child_collapse_blocked_by_flex.rs | 372 ++- .../blockflex/blockflex_overflow_hidden.rs | 290 ++- .../blockgrid/blockgrid_block_in_grid_auto.rs | 262 +- ..._block_in_grid_fixed_fit_content_larger.rs | 262 +- ..._block_in_grid_fixed_fit_content_middle.rs | 262 +- ...block_in_grid_fixed_fit_content_smaller.rs | 262 +- .../blockgrid_block_in_grid_fixed_larger.rs | 262 +- .../blockgrid_block_in_grid_fixed_middle.rs | 262 +- .../blockgrid_block_in_grid_fixed_smaller.rs | 262 +- .../blockgrid/blockgrid_block_in_grid_fr.rs | 262 +- .../blockgrid_block_in_grid_max_content.rs | 262 +- .../blockgrid_block_in_grid_min_content.rs | 262 +- .../blockgrid/blockgrid_grid_in_block.rs | 360 ++- ...rgin_y_collapse_through_blocked_by_grid.rs | 348 ++- ..._y_first_child_collapse_blocked_by_grid.rs | 372 ++- ...n_y_last_child_collapse_blocked_by_grid.rs | 372 ++- ...ct_ratio_overrides_height_of_full_inset.rs | 188 +- .../flex/absolute_aspect_ratio_fill_height.rs | 176 +- ...ute_aspect_ratio_fill_height_from_inset.rs | 188 +- .../absolute_aspect_ratio_fill_max_height.rs | 190 +- .../absolute_aspect_ratio_fill_max_width.rs | 190 +- .../absolute_aspect_ratio_fill_min_height.rs | 176 +- .../absolute_aspect_ratio_fill_min_width.rs | 176 +- .../flex/absolute_aspect_ratio_fill_width.rs | 176 +- ...lute_aspect_ratio_fill_width_from_inset.rs | 176 +- ...ute_aspect_ratio_height_overrides_inset.rs | 176 +- ...lute_aspect_ratio_width_overrides_inset.rs | 176 +- .../flex/absolute_child_with_cross_margin.rs | 348 ++- .../flex/absolute_child_with_main_margin.rs | 176 +- .../flex/absolute_child_with_max_height.rs | 274 ++- ...max_height_larger_shrinkable_grandchild.rs | 286 ++- ..._align_items_and_justify_content_center.rs | 176 +- ...tify_content_center_and_bottom_position.rs | 176 +- ...ustify_content_center_and_left_position.rs | 176 +- ...stify_content_center_and_right_position.rs | 176 +- ...justify_content_center_and_top_position.rs | 176 +- ...lign_items_and_justify_content_flex_end.rs | 176 +- .../absolute_layout_align_items_center.rs | 176 +- ...layout_align_items_center_on_child_only.rs | 176 +- .../flex/absolute_layout_child_order.rs | 348 ++- ...layout_in_wrap_reverse_column_container.rs | 176 +- ..._wrap_reverse_column_container_flex_end.rs | 176 +- ...te_layout_in_wrap_reverse_row_container.rs | 176 +- ..._in_wrap_reverse_row_container_flex_end.rs | 176 +- .../absolute_layout_justify_content_center.rs | 176 +- .../generated/flex/absolute_layout_no_size.rs | 176 +- ...ercentage_bottom_based_on_parent_height.rs | 360 ++- .../flex/absolute_layout_percentage_height.rs | 176 +- ...lute_layout_row_width_height_end_bottom.rs | 176 +- .../absolute_layout_start_top_end_bottom.rs | 176 +- ...absolute_layout_width_height_end_bottom.rs | 176 +- .../absolute_layout_width_height_start_top.rs | 176 +- ...ayout_width_height_start_top_end_bottom.rs | 176 +- .../flex/absolute_layout_within_border.rs | 434 +++- .../flex/absolute_margin_bottom_left.rs | 176 +- .../flex/absolute_minmax_bottom_right_max.rs | 176 +- .../absolute_minmax_bottom_right_min_max.rs | 176 +- ...e_minmax_bottom_right_min_max_preferred.rs | 176 +- ...solute_minmax_top_left_bottom_right_max.rs | 176 +- ...te_minmax_top_left_bottom_right_min_max.rs | 176 +- ...olute_padding_border_overrides_max_size.rs | 176 +- .../absolute_padding_border_overrides_size.rs | 176 +- .../flex/absolute_resolved_insets.rs | 1378 +++++++++-- tests/generated/flex/align_baseline.rs | 262 +- tests/generated/flex/align_baseline_child.rs | 360 ++- .../flex/align_baseline_child_margin.rs | 360 ++- .../align_baseline_child_margin_percent.rs | 360 ++- .../flex/align_baseline_child_multiline.rs | 654 ++++- ...ild_multiline_no_override_on_secondline.rs | 654 ++++- ...align_baseline_child_multiline_override.rs | 654 ++++- .../flex/align_baseline_child_padding.rs | 360 ++- .../flex/align_baseline_child_top.rs | 360 ++- .../flex/align_baseline_child_top2.rs | 360 ++- tests/generated/flex/align_baseline_column.rs | 262 +- .../align_baseline_double_nested_child.rs | 458 +++- .../flex/align_baseline_multiline.rs | 630 ++++- .../flex/align_baseline_multiline_column.rs | 630 ++++- .../flex/align_baseline_multiline_column2.rs | 630 ++++- ...align_baseline_multiline_row_and_column.rs | 630 ++++- .../flex/align_baseline_nested_child.rs | 360 ++- .../flex/align_baseline_nested_column.rs | 556 ++++- ...ign_center_should_size_based_on_content.rs | 372 ++- .../flex/align_content_center_single_line.rs | 606 ++++- ...ntent_center_single_line_negative_space.rs | 274 ++- ...t_center_single_line_negative_space_gap.rs | 274 ++- .../flex/align_content_center_wrapped.rs | 606 ++++- ...n_content_center_wrapped_negative_space.rs | 470 +++- ...ntent_center_wrapped_negative_space_gap.rs | 470 +++- tests/generated/flex/align_content_end.rs | 520 +++- ..._content_end_single_line_negative_space.rs | 274 ++- ...tent_end_single_line_negative_space_gap.rs | 274 ++- ...lign_content_end_wrapped_negative_space.rs | 470 +++- ..._content_end_wrapped_negative_space_gap.rs | 470 +++- .../generated/flex/align_content_flex_end.rs | 520 +++- .../flex/align_content_flex_start.rs | 520 +++- .../align_content_flex_start_with_flex.rs | 520 +++- ...t_flex_start_without_height_on_children.rs | 520 +++- ...nt_not_stretch_with_align_items_stretch.rs | 458 +++- .../align_content_space_around_single_line.rs | 606 ++++- ...space_around_single_line_negative_space.rs | 274 ++- ...e_around_single_line_negative_space_gap.rs | 274 ++- .../align_content_space_around_wrapped.rs | 606 ++++- ...ent_space_around_wrapped_negative_space.rs | 470 +++- ...space_around_wrapped_negative_space_gap.rs | 470 +++- ...ign_content_space_around_wrapped_single.rs | 176 +- ...align_content_space_between_single_line.rs | 606 ++++- ...pace_between_single_line_negative_space.rs | 274 ++- ..._between_single_line_negative_space_gap.rs | 274 ++- .../align_content_space_between_wrapped.rs | 606 ++++- ...nt_space_between_wrapped_negative_space.rs | 470 +++- ...pace_between_wrapped_negative_space_gap.rs | 470 +++- ...gn_content_space_between_wrapped_single.rs | 176 +- .../align_content_space_evenly_single_line.rs | 606 ++++- ...space_evenly_single_line_negative_space.rs | 274 ++- ...e_evenly_single_line_negative_space_gap.rs | 274 ++- .../align_content_space_evenly_wrapped.rs | 606 ++++- ...ent_space_evenly_wrapped_negative_space.rs | 470 +++- ...space_evenly_wrapped_negative_space_gap.rs | 470 +++- ...ign_content_space_evenly_wrapped_single.rs | 176 +- .../flex/align_content_spacearound.rs | 520 +++- .../flex/align_content_spacebetween.rs | 520 +++- tests/generated/flex/align_content_start.rs | 520 +++- ...ontent_start_single_line_negative_space.rs | 274 ++- ...nt_start_single_line_negative_space_gap.rs | 274 ++- ...gn_content_start_wrapped_negative_space.rs | 470 +++- tests/generated/flex/align_content_stretch.rs | 520 +++- .../flex/align_content_stretch_column.rs | 618 ++++- ...t_stretch_is_not_overriding_align_items.rs | 286 ++- .../flex/align_content_stretch_row.rs | 520 +++- ...align_content_stretch_row_with_children.rs | 618 ++++- ...n_content_stretch_row_with_fixed_height.rs | 520 +++- .../align_content_stretch_row_with_flex.rs | 580 ++++- ...content_stretch_row_with_flex_no_shrink.rs | 580 ++++- .../align_content_stretch_row_with_margin.rs | 520 +++- ...ign_content_stretch_row_with_max_height.rs | 520 +++- ...ign_content_stretch_row_with_min_height.rs | 520 +++- .../align_content_stretch_row_with_padding.rs | 520 +++- ...ign_content_stretch_row_with_single_row.rs | 286 ++- .../flex/align_content_stretch_row_wrap.rs | 286 ++- ...lign_flex_start_with_shrinking_children.rs | 372 ++- ...rt_with_shrinking_children_with_stretch.rs | 372 ++- ...ign_flex_start_with_stretching_children.rs | 384 ++- tests/generated/flex/align_items_center.rs | 176 +- ...er_child_with_margin_bigger_than_parent.rs | 274 ++- ...child_without_margin_bigger_than_parent.rs | 274 ++- ...ign_items_center_justify_content_center.rs | 372 ++- ...align_items_center_min_max_with_padding.rs | 176 +- .../align_items_center_with_child_margin.rs | 176 +- .../flex/align_items_center_with_child_top.rs | 176 +- ...th_height_with_padding_border_with_wrap.rs | 678 +++++- ...ercentage_with_align_content_flex_start.rs | 372 ++- ...ax_height_with_align_content_flex_start.rs | 274 ++- ...ter_with_max_height_with_padding_border.rs | 678 +++++- ...ercentage_with_align_content_flex_start.rs | 384 ++- ...in_height_with_align_content_flex_start.rs | 262 +- ...with_align_content_flex_start_with_wrap.rs | 1266 +++++++++- ...ter_with_min_height_with_padding_border.rs | 678 +++++- tests/generated/flex/align_items_flex_end.rs | 176 +- ...nd_child_with_margin_bigger_than_parent.rs | 274 ++- ...child_without_margin_bigger_than_parent.rs | 274 ++- .../generated/flex/align_items_flex_start.rs | 176 +- tests/generated/flex/align_items_min_max.rs | 176 +- tests/generated/flex/align_items_stretch.rs | 188 +- .../flex/align_items_stretch_min_cross.rs | 176 +- tests/generated/flex/align_self_baseline.rs | 360 ++- tests/generated/flex/align_self_center.rs | 176 +- .../align_self_center_undefined_max_height.rs | 262 +- tests/generated/flex/align_self_flex_end.rs | 176 +- ...align_self_flex_end_override_flex_start.rs | 176 +- tests/generated/flex/align_self_flex_start.rs | 176 +- ...ign_stretch_should_size_based_on_parent.rs | 384 ++- tests/generated/flex/android_news_feed.rs | 2138 +++++++++++++++-- .../aspect_ratio_flex_column_fill_height.rs | 176 +- ...spect_ratio_flex_column_fill_max_height.rs | 203 +- ...aspect_ratio_flex_column_fill_max_width.rs | 176 +- ...spect_ratio_flex_column_fill_min_height.rs | 176 +- ...aspect_ratio_flex_column_fill_min_width.rs | 176 +- .../aspect_ratio_flex_column_fill_width.rs | 176 +- ...spect_ratio_flex_column_fill_width_flex.rs | 176 +- ...t_ratio_flex_column_stretch_fill_height.rs | 176 +- ...tio_flex_column_stretch_fill_max_height.rs | 203 +- ...atio_flex_column_stretch_fill_max_width.rs | 176 +- ...ct_ratio_flex_column_stretch_fill_width.rs | 176 +- .../flex/aspect_ratio_flex_row_fill_height.rs | 176 +- .../aspect_ratio_flex_row_fill_max_height.rs | 203 +- .../aspect_ratio_flex_row_fill_max_width.rs | 176 +- .../aspect_ratio_flex_row_fill_min_height.rs | 176 +- .../aspect_ratio_flex_row_fill_min_width.rs | 176 +- .../flex/aspect_ratio_flex_row_fill_width.rs | 176 +- .../aspect_ratio_flex_row_fill_width_flex.rs | 176 +- ...pect_ratio_flex_row_stretch_fill_height.rs | 188 +- ..._ratio_flex_row_stretch_fill_max_height.rs | 215 +- ...t_ratio_flex_row_stretch_fill_max_width.rs | 176 +- ...spect_ratio_flex_row_stretch_fill_width.rs | 176 +- .../generated/flex/bevy_issue_10343_block.rs | 384 ++- tests/generated/flex/bevy_issue_10343_flex.rs | 384 ++- tests/generated/flex/bevy_issue_10343_grid.rs | 384 ++- tests/generated/flex/bevy_issue_16304.rs | 470 +++- tests/generated/flex/bevy_issue_21240.rs | 606 ++++- .../generated/flex/bevy_issue_7976_3_level.rs | 286 ++- .../generated/flex/bevy_issue_7976_4_level.rs | 384 ++- .../generated/flex/bevy_issue_7976_reduced.rs | 188 +- tests/generated/flex/bevy_issue_8017.rs | 678 +++++- .../generated/flex/bevy_issue_8017_reduced.rs | 482 +++- tests/generated/flex/bevy_issue_8082.rs | 580 ++++- .../generated/flex/bevy_issue_8082_percent.rs | 580 ++++- tests/generated/flex/bevy_issue_9530.rs | 609 ++++- .../generated/flex/bevy_issue_9530_reduced.rs | 274 ++- .../flex/bevy_issue_9530_reduced2.rs | 274 ++- .../flex/bevy_issue_9530_reduced3.rs | 176 +- .../flex/bevy_issue_9530_reduced4.rs | 176 +- tests/generated/flex/blitz_issue_88.rs | 384 ++- tests/generated/flex/border_center_child.rs | 176 +- .../flex/border_container_match_child.rs | 176 +- tests/generated/flex/border_flex_child.rs | 182 +- tests/generated/flex/border_no_child.rs | 90 +- tests/generated/flex/border_no_size.rs | 90 +- tests/generated/flex/border_stretch_child.rs | 182 +- .../flex/child_min_max_width_flexing.rs | 262 +- .../flex/child_with_padding_align_end.rs | 188 +- .../flex/container_with_unsized_child.rs | 188 +- tests/generated/flex/content_size.rs | 302 ++- .../flex/content_size_with_border.rs | 2074 ++++++++++++++++ tests/generated/flex/display_none.rs | 274 ++- .../flex/display_none_absolute_child.rs | 274 ++- .../generated/flex/display_none_fixed_size.rs | 274 ++- .../generated/flex/display_none_only_node.rs | 90 +- .../generated/flex/display_none_with_child.rs | 458 +++- .../flex/display_none_with_margin.rs | 274 ++- .../flex/display_none_with_position.rs | 274 ++- .../display_none_with_position_absolute.rs | 176 +- ...to_height_of_its_overflow_hidden_parent.rs | 314 ++- .../flex/flex_absolute_overflow_clip.rs | 287 +++ .../flex/flex_absolute_overflow_hidden.rs | 293 +++ .../flex/flex_absolute_overflow_scroll.rs | 293 +++ .../flex/flex_absolute_overflow_visible.rs | 283 +++ ...x_basis_and_main_dimen_set_when_flexing.rs | 262 +- .../flex/flex_basis_flex_grow_column.rs | 262 +- .../flex/flex_basis_flex_grow_row.rs | 286 ++- .../flex/flex_basis_flex_shrink_column.rs | 262 +- .../flex/flex_basis_flex_shrink_row.rs | 286 ++- .../flex_basis_larger_than_content_column.rs | 274 ++- .../flex_basis_larger_than_content_row.rs | 286 ++- .../flex/flex_basis_overrides_main_size.rs | 384 ++- ..._then_content_with_flex_grow_large_size.rs | 482 +++- .../flex_basis_smaller_than_content_column.rs | 286 ++- .../flex_basis_smaller_than_content_row.rs | 286 ++- ...ex_basis_smaller_than_main_dimen_column.rs | 176 +- .../flex_basis_smaller_than_main_dimen_row.rs | 176 +- ..._then_content_with_flex_grow_large_size.rs | 482 +++- ..._then_content_with_flex_grow_small_size.rs | 482 +++- ...ontent_with_flex_grow_unconstraint_size.rs | 482 +++- ..._content_with_flex_grow_very_large_size.rs | 482 +++- .../flex/flex_basis_unconstraint_column.rs | 176 +- .../flex/flex_basis_unconstraint_row.rs | 188 +- .../flex_basis_zero_undefined_main_size.rs | 274 ++- .../flex/flex_column_relative_all_sides.rs | 176 +- tests/generated/flex/flex_direction_column.rs | 348 ++- .../flex/flex_direction_column_no_height.rs | 348 ++- .../flex/flex_direction_column_reverse.rs | 348 ++- ...flex_direction_column_reverse_no_height.rs | 348 ++- tests/generated/flex/flex_direction_row.rs | 384 ++- .../flex/flex_direction_row_no_width.rs | 384 ++- .../flex/flex_direction_row_reverse.rs | 384 ++- tests/generated/flex/flex_grow_0_min_size.rs | 458 +++- tests/generated/flex/flex_grow_child.rs | 188 +- .../flex_grow_flex_basis_percent_min_max.rs | 262 +- .../flex/flex_grow_height_maximized.rs | 384 ++- .../flex/flex_grow_in_at_most_container.rs | 262 +- .../flex/flex_grow_less_than_factor_one.rs | 384 ++- .../flex/flex_grow_root_minimized.rs | 384 ++- .../flex/flex_grow_shrink_at_most.rs | 286 ++- tests/generated/flex/flex_grow_to_min.rs | 262 +- ...flex_grow_within_constrained_max_column.rs | 262 +- .../flex_grow_within_constrained_max_row.rs | 384 ++- .../flex_grow_within_constrained_max_width.rs | 274 ++- ...flex_grow_within_constrained_min_column.rs | 262 +- ..._grow_within_constrained_min_max_column.rs | 262 +- .../flex_grow_within_constrained_min_row.rs | 286 ++- .../flex/flex_grow_within_max_width.rs | 274 ++- .../flex/flex_inflow_overflow_clip.rs | 273 +++ .../flex/flex_inflow_overflow_hidden.rs | 279 +++ .../flex/flex_inflow_overflow_scroll.rs | 279 +++ .../flex/flex_inflow_overflow_visible.rs | 269 +++ tests/generated/flex/flex_root_ignored.rs | 286 ++- .../flex/flex_row_relative_all_sides.rs | 188 +- ...ex_shrink_by_outer_margin_with_max_size.rs | 176 +- ...flex_grow_child_flex_shrink_other_child.rs | 286 ++- .../flex/flex_shrink_flex_grow_row.rs | 286 ++- tests/generated/flex/flex_shrink_to_zero.rs | 348 ++- .../flex_wrap_align_stretch_fits_one_row.rs | 286 ++- ...ren_with_min_main_overriding_flex_basis.rs | 262 +- .../flex/flex_wrap_wrap_to_child_height.rs | 494 +++- .../flex/gap_column_gap_child_margins.rs | 384 ++- .../gap_column_gap_determines_parent_width.rs | 384 ++- .../generated/flex/gap_column_gap_flexible.rs | 384 ++- ...ap_column_gap_flexible_undefined_parent.rs | 384 ++- .../flex/gap_column_gap_inflexible.rs | 384 ++- ..._column_gap_inflexible_undefined_parent.rs | 384 ++- .../flex/gap_column_gap_justify_center.rs | 384 ++- .../flex/gap_column_gap_justify_flex_end.rs | 384 ++- .../flex/gap_column_gap_justify_flex_start.rs | 384 ++- .../gap_column_gap_justify_space_around.rs | 384 ++- .../gap_column_gap_justify_space_between.rs | 384 ++- .../gap_column_gap_justify_space_evenly.rs | 384 ++- .../flex/gap_column_gap_mixed_flexible.rs | 384 ++- ..._percentage_cyclic_partially_shrinkable.rs | 348 ++- ...column_gap_percentage_cyclic_shrinkable.rs | 348 ++- ...lumn_gap_percentage_cyclic_unshrinkable.rs | 348 ++- .../gap_column_gap_percentage_flexible.rs | 384 ++- ...mn_gap_percentage_flexible_with_padding.rs | 366 ++- .../gap_column_gap_percentage_inflexible.rs | 384 ++- .../flex/gap_column_gap_row_gap_wrapping.rs | 864 ++++++- .../flex/gap_column_gap_start_index.rs | 434 +++- .../flex/gap_column_gap_wrap_align_center.rs | 606 ++++- .../gap_column_gap_wrap_align_flex_end.rs | 606 ++++- .../gap_column_gap_wrap_align_flex_start.rs | 606 ++++- .../gap_column_gap_wrap_align_space_around.rs | 606 ++++- ...gap_column_gap_wrap_align_space_between.rs | 606 ++++- .../flex/gap_column_gap_wrap_align_stretch.rs | 580 ++++- .../flex/gap_column_row_gap_wrapping.rs | 864 ++++++- .../flex/gap_row_gap_align_items_end.rs | 606 ++++- .../flex/gap_row_gap_align_items_stretch.rs | 606 ++++- .../flex/gap_row_gap_column_child_margins.rs | 348 ++- .../gap_row_gap_determines_parent_height.rs | 348 ++- .../flex/gap_row_gap_percentage_wrapping.rs | 864 ++++++- .../gap_row_gap_row_wrap_child_margins.rs | 348 ++- .../intrinsic_sizing_cross_size_column.rs | 90 +- .../flex/intrinsic_sizing_main_size_column.rs | 90 +- ...ntrinsic_sizing_main_size_column_nested.rs | 176 +- .../intrinsic_sizing_main_size_column_wrap.rs | 262 +- .../intrinsic_sizing_main_size_min_size.rs | 274 ++- .../flex/intrinsic_sizing_main_size_row.rs | 90 +- .../intrinsic_sizing_main_size_row_nested.rs | 176 +- .../intrinsic_sizing_main_size_row_wrap.rs | 262 +- .../flex/justify_content_column_center.rs | 348 ++- ...fy_content_column_center_negative_space.rs | 470 +++- ...ontent_column_center_negative_space_gap.rs | 470 +++- .../flex/justify_content_column_end.rs | 348 ++- ...stify_content_column_end_negative_space.rs | 470 +++- ...y_content_column_end_negative_space_gap.rs | 470 +++- .../justify_content_column_end_reverse.rs | 348 ++- .../flex/justify_content_column_flex_end.rs | 348 ++- ...justify_content_column_flex_end_reverse.rs | 348 ++- .../flex/justify_content_column_flex_start.rs | 348 ++- ...stify_content_column_flex_start_reverse.rs | 348 ++- ...fy_content_column_max_height_and_margin.rs | 274 ++- ...fy_content_column_min_height_and_margin.rs | 274 ++- ...ent_column_min_height_and_margin_bottom.rs | 176 +- ...ontent_column_min_height_and_margin_top.rs | 176 +- .../justify_content_column_space_around.rs | 348 ++- ...tent_column_space_around_negative_space.rs | 470 +++- ..._column_space_around_negative_space_gap.rs | 470 +++- .../justify_content_column_space_between.rs | 348 ++- ...ent_column_space_between_negative_space.rs | 470 +++- ...column_space_between_negative_space_gap.rs | 470 +++- .../justify_content_column_space_evenly.rs | 348 ++- ...tent_column_space_evenly_negative_space.rs | 470 +++- ..._column_space_evenly_negative_space_gap.rs | 470 +++- .../flex/justify_content_column_start.rs | 348 ++- ...ify_content_column_start_negative_space.rs | 470 +++- ...content_column_start_negative_space_gap.rs | 470 +++- .../justify_content_column_start_reverse.rs | 348 ++- .../generated/flex/justify_content_min_max.rs | 176 +- ...padding_child_width_greater_than_parent.rs | 420 +++- ...h_padding_child_width_lower_than_parent.rs | 420 +++- .../flex/justify_content_overflow_min_max.rs | 348 ++- .../flex/justify_content_row_center.rs | 384 ++- .../flex/justify_content_row_flex_end.rs | 384 ++- .../flex/justify_content_row_flex_start.rs | 384 ++- ...ustify_content_row_max_width_and_margin.rs | 176 +- ...ustify_content_row_min_width_and_margin.rs | 176 +- .../flex/justify_content_row_space_around.rs | 384 ++- .../flex/justify_content_row_space_between.rs | 384 ++- .../flex/justify_content_row_space_evenly.rs | 348 ++- .../generated/flex/margin_and_flex_column.rs | 176 +- tests/generated/flex/margin_and_flex_row.rs | 188 +- .../flex/margin_and_stretch_column.rs | 188 +- .../generated/flex/margin_and_stretch_row.rs | 176 +- tests/generated/flex/margin_auto_bottom.rs | 262 +- .../flex/margin_auto_bottom_and_top.rs | 262 +- ...rgin_auto_bottom_and_top_justify_center.rs | 262 +- tests/generated/flex/margin_auto_left.rs | 262 +- .../flex/margin_auto_left_and_right.rs | 262 +- .../flex/margin_auto_left_and_right_column.rs | 262 +- ...n_auto_left_and_right_column_and_center.rs | 262 +- .../margin_auto_left_and_right_stretch.rs | 262 +- ...rgin_auto_left_child_bigger_than_parent.rs | 176 +- ...left_fix_right_child_bigger_than_parent.rs | 176 +- ...uto_left_right_child_bigger_than_parent.rs | 176 +- .../flex/margin_auto_left_stretching_child.rs | 262 +- .../margin_auto_multiple_children_column.rs | 348 ++- .../flex/margin_auto_multiple_children_row.rs | 348 ++- tests/generated/flex/margin_auto_right.rs | 262 +- tests/generated/flex/margin_auto_top.rs | 262 +- .../margin_auto_top_and_bottom_stretch.rs | 262 +- .../flex/margin_auto_top_stretching_child.rs | 262 +- tests/generated/flex/margin_bottom.rs | 176 +- ...eft_auto_right_child_bigger_than_parent.rs | 176 +- tests/generated/flex/margin_left.rs | 188 +- tests/generated/flex/margin_right.rs | 188 +- ...margin_should_not_be_part_of_max_height.rs | 188 +- .../margin_should_not_be_part_of_max_width.rs | 188 +- tests/generated/flex/margin_top.rs | 176 +- .../flex/margin_with_sibling_column.rs | 262 +- .../generated/flex/margin_with_sibling_row.rs | 286 ++- tests/generated/flex/max_height.rs | 176 +- .../flex/max_height_overrides_height.rs | 188 +- .../max_height_overrides_height_on_root.rs | 90 +- tests/generated/flex/max_width.rs | 176 +- .../flex/max_width_overrides_width.rs | 176 +- .../flex/max_width_overrides_width_on_root.rs | 90 +- tests/generated/flex/measure_child.rs | 176 +- .../generated/flex/measure_child_absolute.rs | 176 +- .../flex/measure_child_constraint.rs | 204 +- ...measure_child_constraint_padding_parent.rs | 204 +- .../flex/measure_child_with_flex_grow.rs | 262 +- .../flex/measure_child_with_flex_shrink.rs | 262 +- .../measure_child_with_flex_shrink_hidden.rs | 290 ++- ...h_min_size_greater_than_available_space.rs | 176 +- .../measure_flex_basis_overrides_measure.rs | 176 +- .../flex/measure_height_overrides_measure.rs | 176 +- .../measure_remeasure_child_after_growing.rs | 262 +- ...measure_remeasure_child_after_shrinking.rs | 262 +- ...easure_remeasure_child_after_stretching.rs | 188 +- tests/generated/flex/measure_root.rs | 90 +- .../flex/measure_stretch_overrides_measure.rs | 262 +- .../flex/measure_width_overrides_measure.rs | 176 +- tests/generated/flex/min_height.rs | 262 +- .../flex/min_height_larger_than_height.rs | 176 +- .../flex/min_height_overrides_height.rs | 188 +- .../min_height_overrides_height_on_root.rs | 90 +- .../flex/min_height_overrides_max_height.rs | 188 +- .../min_height_with_nested_fixed_height.rs | 274 ++- .../min_max_percent_different_width_height.rs | 176 +- .../flex/min_max_percent_no_width_height.rs | 176 +- tests/generated/flex/min_width.rs | 286 ++- .../flex/min_width_larger_than_width.rs | 176 +- .../flex/min_width_overrides_max_width.rs | 176 +- .../flex/min_width_overrides_width.rs | 176 +- .../flex/min_width_overrides_width_on_root.rs | 90 +- tests/generated/flex/mod.rs | 9 + .../flex/multiline_column_max_height.rs | 1930 +++++++++++++-- tests/generated/flex/multiline_min_max_12.rs | 434 +++- tests/generated/flex/multiline_min_max_13.rs | 434 +++- tests/generated/flex/multiline_min_max_14.rs | 434 +++- tests/generated/flex/multiline_min_max_5.rs | 434 +++- tests/generated/flex/multiline_min_max_8.rs | 434 +++- .../flex/nested_overflowing_child.rs | 286 ++- ..._overflowing_child_in_constraint_parent.rs | 286 ++- ...ly_shrinkable_item_with_flex_basis_zero.rs | 360 ++- tests/generated/flex/overflow_cross_axis.rs | 188 +- tests/generated/flex/overflow_main_axis.rs | 188 +- .../flex/overflow_main_axis_shrink_hidden.rs | 204 +- .../flex/overflow_main_axis_shrink_scroll.rs | 204 +- .../flex/overflow_main_axis_shrink_visible.rs | 176 +- ...ow_scroll_main_axis_justify_content_end.rs | 188 +- ...crollbars_overridden_by_available_space.rs | 290 ++- ...rflow_scrollbars_overridden_by_max_size.rs | 204 +- .../overflow_scrollbars_overridden_by_size.rs | 204 +- ...flow_scrollbars_take_up_space_both_axis.rs | 204 +- ...low_scrollbars_take_up_space_cross_axis.rs | 204 +- ...flow_scrollbars_take_up_space_main_axis.rs | 204 +- .../generated/flex/padding_align_end_child.rs | 188 +- .../flex/padding_border_overrides_max_size.rs | 176 +- .../flex/padding_border_overrides_min_size.rs | 176 +- .../flex/padding_border_overrides_size.rs | 176 +- ...er_overrides_size_flex_basis_0_growable.rs | 262 +- .../padding_border_overrides_size_root.rs | 176 +- tests/generated/flex/padding_center_child.rs | 176 +- .../flex/padding_container_match_child.rs | 176 +- tests/generated/flex/padding_flex_child.rs | 182 +- tests/generated/flex/padding_no_child.rs | 90 +- tests/generated/flex/padding_no_size.rs | 90 +- tests/generated/flex/padding_stretch_child.rs | 176 +- ...rent_wrap_child_size_overflowing_parent.rs | 286 ++- .../flex/percent_absolute_position.rs | 372 ++- .../flex/percent_within_flex_grow.rs | 470 +++- .../flex/percentage_absolute_position.rs | 176 +- ...centage_container_in_wrapping_container.rs | 470 +++- .../flex/percentage_different_width_height.rs | 262 +- ...ercentage_different_width_height_column.rs | 274 ++- tests/generated/flex/percentage_flex_basis.rs | 286 ++- .../flex/percentage_flex_basis_cross.rs | 286 ++- .../percentage_flex_basis_cross_max_height.rs | 274 ++- .../percentage_flex_basis_cross_max_width.rs | 286 ++- .../percentage_flex_basis_cross_min_height.rs | 286 ++- .../percentage_flex_basis_cross_min_width.rs | 286 ++- .../percentage_flex_basis_main_max_height.rs | 274 ++- .../percentage_flex_basis_main_max_width.rs | 286 ++- .../percentage_flex_basis_main_min_width.rs | 286 ++- .../flex/percentage_main_max_height.rs | 384 ++- ...in_should_calculate_based_only_on_width.rs | 274 ++- .../flex/percentage_moderate_complexity.rs | 328 ++- .../flex/percentage_moderate_complexity2.rs | 274 ++- ...th_padding_margin_and_percentage_values.rs | 470 +++- ...ng_should_calculate_based_only_on_width.rs | 286 ++- .../flex/percentage_position_bottom_right.rs | 176 +- .../flex/percentage_position_left_top.rs | 188 +- ...centage_size_based_on_parent_inner_size.rs | 188 +- .../flex/percentage_size_of_flex_basis.rs | 286 ++- ...sizes_should_not_prevent_flex_shrinking.rs | 286 ++- .../generated/flex/percentage_width_height.rs | 188 +- ...tage_width_height_undefined_parent_size.rs | 176 +- ...th_rtl_should_position_withoutdirection.rs | 176 +- ...tive_position_should_not_nudge_siblings.rs | 262 +- ..._basis_flex_grow_row_prime_number_width.rs | 580 ++++- ...g_flex_basis_flex_grow_row_width_of_100.rs | 384 ++- .../rounding_flex_basis_flex_shrink_row.rs | 384 ++- ...rounding_flex_basis_overrides_main_size.rs | 348 ++- .../flex/rounding_fractial_input_1.rs | 348 ++- .../flex/rounding_fractial_input_2.rs | 348 ++- .../flex/rounding_fractial_input_3.rs | 348 ++- .../flex/rounding_fractial_input_4.rs | 348 ++- .../flex/rounding_fractial_input_5.rs | 286 ++- .../flex/rounding_fractial_input_6.rs | 654 ++++- .../flex/rounding_fractial_input_7.rs | 1218 +++++++++- ...ounding_inner_node_controversy_combined.rs | 788 +++++- ...nding_inner_node_controversy_horizontal.rs | 446 +++- ...ounding_inner_node_controversy_vertical.rs | 482 +++- .../generated/flex/rounding_total_fractial.rs | 348 ++- .../flex/rounding_total_fractial_nested.rs | 544 ++++- tests/generated/flex/scroll_size.rs | 216 +- tests/generated/flex/simple_child.rs | 678 +++++- .../single_flex_child_after_absolute_child.rs | 384 ++- tests/generated/flex/size_defined_by_child.rs | 188 +- .../flex/size_defined_by_child_with_border.rs | 176 +- .../size_defined_by_child_with_padding.rs | 176 +- .../flex/size_defined_by_grand_child.rs | 286 ++- tests/generated/flex/taffy_issue_696.rs | 314 ++- .../flex/taffy_issue_696_flex_basis_20.rs | 314 ++- .../flex/taffy_issue_696_min_height.rs | 286 ++- .../flex/taffy_issue_696_no_flex_basis.rs | 314 ++- .../flex/taffy_issue_696_overflow_hidden.rs | 302 ++- .../flex/undefined_height_with_min_max.rs | 176 +- .../flex/undefined_width_with_min_max.rs | 176 +- .../flex/undefined_width_with_min_max_row.rs | 274 ++- ..._then_content_with_flex_grow_large_size.rs | 482 +++- ..._then_content_with_flex_grow_small_size.rs | 482 +++- ...ontent_with_flex_grow_unconstraint_size.rs | 482 +++- ..._content_with_flex_grow_very_large_size.rs | 482 +++- tests/generated/flex/wrap_child.rs | 188 +- tests/generated/flex/wrap_column.rs | 434 +++- tests/generated/flex/wrap_grandchild.rs | 286 ++- ..._nodes_with_content_sizing_margin_cross.rs | 568 ++++- ..._with_content_sizing_overflowing_margin.rs | 568 ++++- tests/generated/flex/wrap_reverse_column.rs | 434 +++- .../flex/wrap_reverse_column_fixed_size.rs | 520 +++- tests/generated/flex/wrap_reverse_row.rs | 434 +++- .../wrap_reverse_row_align_content_center.rs | 520 +++- ...ap_reverse_row_align_content_flex_start.rs | 520 +++- ..._reverse_row_align_content_space_around.rs | 520 +++- .../wrap_reverse_row_align_content_stretch.rs | 520 +++- ..._reverse_row_single_line_different_size.rs | 520 +++- tests/generated/flex/wrap_row.rs | 434 +++- .../flex/wrap_row_align_items_center.rs | 434 +++- .../flex/wrap_row_align_items_flex_end.rs | 434 +++- .../flex/wrapped_column_max_height.rs | 384 ++- .../flex/wrapped_column_max_height_flex.rs | 384 ++- .../wrapped_row_within_align_items_center.rs | 384 ++- ...wrapped_row_within_align_items_flex_end.rs | 384 ++- ...apped_row_within_align_items_flex_start.rs | 384 ++- .../generated/grid/chrome_issue_325928327.rs | 274 ++- .../grid_absolute_align_self_sized_all.rs | 778 +++++- .../grid/grid_absolute_column_end.rs | 188 +- .../grid/grid_absolute_column_start.rs | 188 +- .../grid_absolute_container_bottom_left.rs | 864 ++++++- ...d_absolute_container_bottom_left_margin.rs | 864 ++++++- ...absolute_container_left_overrides_right.rs | 864 ++++++- .../grid_absolute_container_left_right.rs | 864 ++++++- ...id_absolute_container_left_right_margin.rs | 864 ++++++- ...id_absolute_container_negative_position.rs | 864 ++++++- ...lute_container_negative_position_margin.rs | 864 ++++++- .../grid_absolute_container_top_bottom.rs | 876 ++++++- ...id_absolute_container_top_bottom_margin.rs | 876 ++++++- .../grid/grid_absolute_container_top_right.rs | 864 ++++++- ...rid_absolute_container_top_right_margin.rs | 864 ++++++- .../grid_absolute_justify_self_sized_all.rs | 778 +++++- .../grid_absolute_layout_within_border.rs | 434 +++- ...id_absolute_layout_within_border_static.rs | 434 +++- .../grid/grid_absolute_overflow_clip.rs | 289 +++ .../grid/grid_absolute_overflow_hidden.rs | 295 +++ .../grid/grid_absolute_overflow_scroll.rs | 295 +++ .../grid/grid_absolute_overflow_visible.rs | 285 +++ .../grid/grid_absolute_resolved_insets.rs | 1378 +++++++++-- tests/generated/grid/grid_absolute_row_end.rs | 176 +- .../generated/grid/grid_absolute_row_start.rs | 188 +- .../grid_absolute_top_overrides_bottom.rs | 864 ++++++- .../grid/grid_absolute_with_padding.rs | 864 ++++++- .../grid_absolute_with_padding_and_margin.rs | 864 ++++++- .../grid/grid_align_content_center.rs | 864 ++++++- ...align_content_center_negative_space_gap.rs | 1070 ++++++++- .../generated/grid/grid_align_content_end.rs | 864 ++++++- ...id_align_content_end_negative_space_gap.rs | 1070 ++++++++- ...d_align_content_end_with_padding_border.rs | 864 ++++++- .../grid/grid_align_content_space_around.rs | 864 ++++++- ...content_space_around_negative_space_gap.rs | 1070 ++++++++- ...ontent_space_around_with_padding_border.rs | 864 ++++++- .../grid/grid_align_content_space_between.rs | 864 ++++++- ...ontent_space_between_negative_space_gap.rs | 1070 ++++++++- ...ntent_space_between_with_padding_border.rs | 864 ++++++- .../grid/grid_align_content_space_evenly.rs | 864 ++++++- ...content_space_evenly_negative_space_gap.rs | 1070 ++++++++- ...ontent_space_evenly_with_padding_border.rs | 864 ++++++- .../grid/grid_align_content_start.rs | 864 ++++++- ..._align_content_start_negative_space_gap.rs | 1070 ++++++++- ...align_content_start_with_padding_border.rs | 864 ++++++- .../grid/grid_align_items_baseline.rs | 262 +- .../grid/grid_align_items_baseline_child.rs | 360 ++- .../grid_align_items_baseline_child_margin.rs | 360 ++- ...ign_items_baseline_child_margin_percent.rs | 360 ++- ...id_align_items_baseline_child_multiline.rs | 654 ++++- ...ild_multiline_no_override_on_secondline.rs | 654 ++++- ...items_baseline_child_multiline_override.rs | 654 ++++- ...grid_align_items_baseline_child_padding.rs | 360 ++- .../grid_align_items_baseline_child_top.rs | 360 ++- .../grid_align_items_baseline_child_top2.rs | 360 ++- .../grid/grid_align_items_baseline_complex.rs | 1244 ++++++++-- ...lign_items_baseline_double_nested_child.rs | 458 +++- .../grid_align_items_baseline_multiline.rs | 630 ++++- ...d_align_items_baseline_multiline_column.rs | 630 ++++- ...items_baseline_multiline_row_and_column.rs | 630 ++++- ...grid_align_items_baseline_nested_column.rs | 556 ++++- .../grid/grid_align_items_sized_center.rs | 262 +- .../grid/grid_align_items_sized_end.rs | 262 +- .../grid/grid_align_items_sized_start.rs | 262 +- .../grid/grid_align_items_sized_stretch.rs | 262 +- .../grid/grid_align_self_sized_all.rs | 778 +++++- ...ct_ratio_overrides_height_of_full_inset.rs | 188 +- ...t_ratio_absolute_fill_height_from_inset.rs | 188 +- ...ct_ratio_absolute_fill_width_from_inset.rs | 176 +- ...t_ratio_absolute_height_overrides_inset.rs | 176 +- ...ct_ratio_absolute_width_overrides_inset.rs | 176 +- ..._aspect_ratio_child_fill_content_height.rs | 262 +- ...d_aspect_ratio_child_fill_content_width.rs | 262 +- .../grid_aspect_ratio_fill_child_height.rs | 176 +- ...grid_aspect_ratio_fill_child_max_height.rs | 176 +- .../grid_aspect_ratio_fill_child_max_width.rs | 176 +- ...grid_aspect_ratio_fill_child_min_height.rs | 176 +- .../grid_aspect_ratio_fill_child_width.rs | 176 +- ...pect_ratio_overridden_by_explicit_sizes.rs | 176 +- ...ratio_overridden_by_explicit_sizes_flex.rs | 176 +- tests/generated/grid/grid_auto_columns.rs | 874 ++++++- .../grid/grid_auto_columns_fixed_width.rs | 1538 ++++++++++-- .../grid/grid_auto_fill_fixed_size.rs | 864 ++++++- .../grid_auto_fill_with_empty_auto_track.rs | 262 +- .../grid/grid_auto_fit_definite_percentage.rs | 972 +++++++- .../grid_auto_fit_with_empty_auto_track.rs | 262 +- tests/generated/grid/grid_auto_rows.rs | 778 +++++- tests/generated/grid/grid_auto_single_item.rs | 864 ++++++- .../grid/grid_auto_single_item_fixed_width.rs | 864 ++++++- ...le_item_fixed_width_with_definite_width.rs | 864 ++++++- .../grid_auto_takes_precedence_over_fr.rs | 262 +- ...vailable_space_greater_than_max_content.rs | 262 +- ...vailable_space_smaller_than_max_content.rs | 262 +- ...vailable_space_smaller_than_min_content.rs | 262 +- tests/generated/grid/grid_basic.rs | 864 ++++++- .../grid/grid_basic_implicit_tracks.rs | 262 +- .../grid/grid_basic_with_overflow.rs | 950 +++++++- .../generated/grid/grid_basic_with_padding.rs | 864 ++++++- .../grid/grid_display_none_fixed_size.rs | 274 ++- ...d_fit_content_percent_definite_argument.rs | 176 +- ...it_content_percent_definite_max_content.rs | 176 +- ...it_content_percent_definite_min_content.rs | 176 +- ...fit_content_percent_indefinite_argument.rs | 176 +- ..._content_percent_indefinite_max_content.rs | 176 +- ...t_percent_indefinite_max_content_hidden.rs | 204 +- ..._content_percent_indefinite_min_content.rs | 176 +- ...t_percent_indefinite_min_content_hidden.rs | 204 +- .../grid/grid_fit_content_points_argument.rs | 176 +- .../grid_fit_content_points_max_content.rs | 176 +- .../grid_fit_content_points_min_content.rs | 176 +- ...d_fit_content_points_min_content_hidden.rs | 204 +- ...id_fr_fixed_size_no_content_proportions.rs | 348 ++- ...d_size_no_content_proportions_sub_1_sum.rs | 262 +- .../grid/grid_fr_fixed_size_single_item.rs | 864 ++++++- .../grid/grid_fr_no_sized_items_indefinite.rs | 864 ++++++- .../grid/grid_fr_single_item_indefinite.rs | 864 ++++++- .../grid/grid_fr_span_2_proportion.rs | 348 ++- .../grid_fr_span_2_proportion_sub_1_sum.rs | 348 ++- ...pan_2_proportion_with_non_spanned_track.rs | 520 +++- .../grid_fr_span_2_proportion_zero_sum.rs | 348 ++- ...portion_zero_sum_with_non_spanned_track.rs | 520 +++- tests/generated/grid/grid_gap.rs | 864 ++++++- tests/generated/grid/grid_hidden.rs | 864 ++++++- .../grid/grid_inflow_overflow_clip.rs | 275 +++ .../grid/grid_inflow_overflow_hidden.rs | 281 +++ .../grid/grid_inflow_overflow_scroll.rs | 281 +++ .../grid/grid_inflow_overflow_visible.rs | 271 +++ .../grid/grid_justify_content_center.rs | 864 ++++++- ...stify_content_center_negative_space_gap.rs | 1070 ++++++++- ...tify_content_center_with_padding_border.rs | 864 ++++++- .../grid/grid_justify_content_end.rs | 864 ++++++- ..._justify_content_end_negative_space_gap.rs | 1070 ++++++++- ...justify_content_end_with_padding_border.rs | 864 ++++++- .../grid/grid_justify_content_space_around.rs | 864 ++++++- ...content_space_around_negative_space_gap.rs | 1070 ++++++++- ...ontent_space_around_with_padding_border.rs | 864 ++++++- .../grid_justify_content_space_between.rs | 864 ++++++- ...ontent_space_between_negative_space_gap.rs | 1070 ++++++++- ...ntent_space_between_with_padding_border.rs | 864 ++++++- .../grid/grid_justify_content_space_evenly.rs | 864 ++++++- ...content_space_evenly_negative_space_gap.rs | 1070 ++++++++- ...ontent_space_evenly_with_padding_border.rs | 864 ++++++- .../grid/grid_justify_content_start.rs | 864 ++++++- ...ustify_content_start_negative_space_gap.rs | 1070 ++++++++- ...stify_content_start_with_padding_border.rs | 864 ++++++- .../grid/grid_justify_items_sized_center.rs | 262 +- .../grid/grid_justify_items_sized_end.rs | 262 +- .../grid/grid_justify_items_sized_start.rs | 262 +- .../grid/grid_justify_items_sized_stretch.rs | 262 +- .../grid/grid_justify_self_sized_all.rs | 778 +++++- .../grid/grid_margins_auto_margins.rs | 864 ++++++- ...d_margins_auto_margins_override_stretch.rs | 864 ++++++- .../grid/grid_margins_fixed_center.rs | 606 ++++- .../generated/grid/grid_margins_fixed_end.rs | 606 ++++- .../grid/grid_margins_fixed_start.rs | 606 ++++- .../grid/grid_margins_fixed_stretch.rs | 606 ++++- .../grid/grid_margins_percent_center.rs | 606 ++++- .../grid/grid_margins_percent_end.rs | 606 ++++- .../grid/grid_margins_percent_start.rs | 606 ++++- .../grid/grid_margins_percent_stretch.rs | 606 ++++- .../grid_max_content_maximum_single_item.rs | 864 ++++++- .../grid/grid_max_content_single_item.rs | 864 ++++++- ...rid_max_content_single_item_margin_auto.rs | 864 ++++++- ...id_max_content_single_item_margin_fixed.rs | 864 ++++++- ..._max_content_single_item_margin_percent.rs | 864 ++++++- .../grid_max_content_single_item_span_2.rs | 864 ++++++- ...ax_content_single_item_span_2_gap_fixed.rs | 864 ++++++- ...single_item_span_2_gap_percent_definite.rs | 864 ++++++- ...ngle_item_span_2_gap_percent_indefinite.rs | 864 ++++++- ...grid_max_width_greater_than_max_content.rs | 372 ++- ..._less_than_max_content_with_min_content.rs | 372 ++- ...grid_max_width_smaller_than_max_content.rs | 372 ++- ...grid_max_width_smaller_than_min_content.rs | 372 ++- .../grid/grid_min_content_flex_column.rs | 470 +++- .../grid/grid_min_content_flex_row.rs | 470 +++- .../grid/grid_min_content_flex_single_item.rs | 778 +++++- ...in_content_flex_single_item_margin_auto.rs | 778 +++++- ...n_content_flex_single_item_margin_fixed.rs | 778 +++++- ...content_flex_single_item_margin_percent.rs | 778 +++++- .../grid_min_content_maximum_single_item.rs | 864 ++++++- .../grid/grid_min_content_single_item.rs | 864 ++++++- .../grid/grid_minmax_auto_fixed_10px.rs | 176 +- .../grid/grid_minmax_auto_max_content.rs | 176 +- .../grid/grid_minmax_auto_min_content.rs | 176 +- .../grid/grid_minmax_auto_percent_definite.rs | 176 +- .../grid_minmax_auto_percent_indefinite.rs | 176 +- ...d_minmax_column_fixed_width_above_range.rs | 864 ++++++- ...d_minmax_column_fixed_width_below_range.rs | 864 ++++++- ..._minmax_column_fixed_width_within_range.rs | 864 ++++++- .../grid/grid_minmax_column_indefinite.rs | 864 ++++++- .../grid_minmax_column_with_auto_fixed.rs | 262 +- .../grid/grid_minmax_column_with_fr_fixed.rs | 262 +- .../grid/grid_minmax_max_content_1fr.rs | 176 +- .../grid/grid_minmax_max_content_auto.rs | 176 +- .../grid_minmax_max_content_fixed_10px.rs | 176 +- .../grid_minmax_max_content_min_content.rs | 176 +- ...rid_minmax_max_content_percent_definite.rs | 176 +- ...d_minmax_max_content_percent_indefinite.rs | 176 +- .../grid/grid_minmax_min_content_1fr.rs | 176 +- .../grid/grid_minmax_min_content_auto.rs | 176 +- .../grid_minmax_min_content_fixed_10px.rs | 176 +- .../grid_minmax_min_content_max_content.rs | 176 +- ...rid_minmax_min_content_percent_definite.rs | 176 +- ...d_minmax_min_content_percent_indefinite.rs | 176 +- .../generated/grid/grid_out_of_order_items.rs | 864 ++++++- .../grid/grid_overflow_inline_axis_hidden.rs | 204 +- .../grid/grid_overflow_inline_axis_scroll.rs | 204 +- .../grid/grid_overflow_inline_axis_visible.rs | 176 +- tests/generated/grid/grid_overflow_rows.rs | 606 ++++- ...crollbars_overridden_by_available_space.rs | 290 ++- ...rflow_scrollbars_overridden_by_max_size.rs | 204 +- ..._overflow_scrollbars_overridden_by_size.rs | 204 +- ...flow_scrollbars_take_up_space_both_axis.rs | 204 +- ...verflow_scrollbars_take_up_space_x_axis.rs | 204 +- ...verflow_scrollbars_take_up_space_y_axis.rs | 204 +- ...ing_border_overrides_container_max_size.rs | 176 +- ...padding_border_overrides_container_size.rs | 176 +- .../grid_padding_border_overrides_max_size.rs | 176 +- .../grid_padding_border_overrides_min_size.rs | 176 +- .../grid_padding_border_overrides_size.rs | 176 +- .../grid_percent_item_inside_stretch_item.rs | 286 ++- ...t_items_nested_inside_stretch_alignment.rs | 274 ++- .../grid_percent_items_nested_moderate.rs | 328 ++- .../grid_percent_items_nested_with_margin.rs | 262 +- ...ercent_items_nested_with_padding_margin.rs | 470 +++- .../grid_percent_items_width_and_margin.rs | 176 +- .../grid_percent_items_width_and_padding.rs | 176 +- .../grid_percent_tracks_definite_overflow.rs | 606 ++++- .../grid_percent_tracks_definite_underflow.rs | 606 ++++- .../grid_percent_tracks_indefinite_only.rs | 606 ++++- ...tracks_indefinite_with_content_overflow.rs | 704 +++++- ...racks_indefinite_with_content_underflow.rs | 704 +++++- .../grid/grid_placement_auto_negative.rs | 348 ++- ...ndary_axis_with_fully_definite_negative.rs | 348 ++- .../grid/grid_placement_definite_primary.rs | 520 +++- .../generated/grid/grid_relative_all_sides.rs | 188 +- .../grid/grid_relayout_vertical_text.rs | 262 +- tests/generated/grid/grid_repeat_integer.rs | 864 ++++++- tests/generated/grid/grid_repeat_mixed.rs | 864 ++++++- .../grid/grid_size_child_fixed_tracks.rs | 520 +++- ...13_most_non_flex_with_minmax_indefinite.rs | 1342 +++++++++-- ..._non_flex_with_minmax_indefinite_hidden.rs | 1378 +++++++++-- ...grid_span_2_max_content_auto_indefinite.rs | 348 ++- ...an_2_max_content_auto_indefinite_hidden.rs | 262 +- ...max_content_fit_content_10px_indefinite.rs | 348 ++- ...tent_fit_content_10px_indefinite_hidden.rs | 384 ++- ...max_content_fit_content_80px_indefinite.rs | 348 ++- ...tent_fit_content_80px_indefinite_hidden.rs | 384 ++- ...an_2_max_content_max_content_indefinite.rs | 348 ++- ...grid_span_2_min_content_auto_indefinite.rs | 348 ++- ...an_2_min_content_auto_indefinite_hidden.rs | 384 ++- ...min_content_fit_content_10px_indefinite.rs | 348 ++- ...tent_fit_content_10px_indefinite_hidden.rs | 384 ++- ...min_content_fit_content_30px_indefinite.rs | 348 ++- ...tent_fit_content_30px_indefinite_hidden.rs | 384 ++- ...min_content_fit_content_80px_indefinite.rs | 348 ++- ...tent_fit_content_80px_indefinite_hidden.rs | 384 ++- ...an_2_min_content_max_content_indefinite.rs | 348 ++- ...an_2_min_content_min_content_indefinite.rs | 348 ++- .../grid_span_6_all_non_flex_indefinite.rs | 692 +++++- ...d_span_6_all_non_flex_indefinite_hidden.rs | 728 +++++- .../grid_span_8_all_track_types_indefinite.rs | 864 ++++++- tests/generated/grid/grid_taffy_issue_624.rs | 348 ++- tests/generated/grid/mod.rs | 16 + .../gridflex/gridflex_column_integration.rs | 568 ++++- .../gridflex/gridflex_kitchen_sink.rs | 1410 ++++++++++- .../gridflex_kitchen_sink_minimise.rs | 372 ++- .../gridflex_kitchen_sink_minimise2.rs | 274 ++- .../gridflex_kitchen_sink_minimise3.rs | 532 +++- .../gridflex/gridflex_row_integration.rs | 568 ++++- tests/generated/leaf/leaf_overflow_clip.rs | 136 ++ .../leaf/leaf_overflow_clip_with_border.rs | 148 ++ ...f_overflow_clip_with_border_and_padding.rs | 162 ++ .../leaf/leaf_overflow_clip_with_padding.rs | 150 ++ tests/generated/leaf/leaf_overflow_hidden.rs | 142 ++ .../leaf/leaf_overflow_hidden_with_border.rs | 154 ++ ...overflow_hidden_with_border_and_padding.rs | 168 ++ .../leaf/leaf_overflow_hidden_with_padding.rs | 156 ++ tests/generated/leaf/leaf_overflow_scroll.rs | 142 ++ .../leaf/leaf_overflow_scroll_with_border.rs | 154 ++ ...overflow_scroll_with_border_and_padding.rs | 168 ++ .../leaf/leaf_overflow_scroll_with_padding.rs | 156 ++ ...crollbars_affect_available_space_x_axis.rs | 118 +- ...crollbars_affect_available_space_y_axis.rs | 118 +- ...crollbars_overridden_by_available_space.rs | 204 +- ...rflow_scrollbars_overridden_by_max_size.rs | 118 +- ..._overflow_scrollbars_overridden_by_size.rs | 118 +- ...flow_scrollbars_take_up_space_both_axis.rs | 118 +- ...verflow_scrollbars_take_up_space_x_axis.rs | 118 +- ...verflow_scrollbars_take_up_space_y_axis.rs | 118 +- tests/generated/leaf/leaf_overflow_visible.rs | 132 + .../leaf/leaf_overflow_visible_with_border.rs | 144 ++ ...verflow_visible_with_border_and_padding.rs | 158 ++ .../leaf_overflow_visible_with_padding.rs | 146 ++ .../leaf_padding_border_overrides_max_size.rs | 90 +- .../leaf_padding_border_overrides_min_size.rs | 90 +- .../leaf_padding_border_overrides_size.rs | 90 +- .../leaf/leaf_with_content_and_border.rs | 90 +- .../leaf/leaf_with_content_and_padding.rs | 90 +- .../leaf_with_content_and_padding_border.rs | 90 +- tests/generated/leaf/mod.rs | 16 + 1125 files changed, 355707 insertions(+), 45519 deletions(-) create mode 100644 test_fixtures/block/block_absolute_overflow_clip.html create mode 100644 test_fixtures/block/block_absolute_overflow_hidden.html create mode 100644 test_fixtures/block/block_absolute_overflow_scroll.html create mode 100644 test_fixtures/block/block_absolute_overflow_visible.html create mode 100644 test_fixtures/block/block_inflow_overflow_clip.html create mode 100644 test_fixtures/block/block_inflow_overflow_hidden.html create mode 100644 test_fixtures/block/block_inflow_overflow_scroll.html create mode 100644 test_fixtures/block/block_inflow_overflow_visible.html create mode 100644 test_fixtures/flex/content_size_with_border.html create mode 100644 test_fixtures/flex/flex_absolute_overflow_clip.html create mode 100644 test_fixtures/flex/flex_absolute_overflow_hidden.html create mode 100644 test_fixtures/flex/flex_absolute_overflow_scroll.html create mode 100644 test_fixtures/flex/flex_absolute_overflow_visible.html create mode 100644 test_fixtures/flex/flex_inflow_overflow_clip.html create mode 100644 test_fixtures/flex/flex_inflow_overflow_hidden.html create mode 100644 test_fixtures/flex/flex_inflow_overflow_scroll.html create mode 100644 test_fixtures/flex/flex_inflow_overflow_visible.html create mode 100644 test_fixtures/grid/grid_absolute_overflow_clip.html create mode 100644 test_fixtures/grid/grid_absolute_overflow_hidden.html create mode 100644 test_fixtures/grid/grid_absolute_overflow_scroll.html create mode 100644 test_fixtures/grid/grid_absolute_overflow_visible.html create mode 100644 test_fixtures/grid/grid_inflow_overflow_clip.html create mode 100644 test_fixtures/grid/grid_inflow_overflow_hidden.html create mode 100644 test_fixtures/grid/grid_inflow_overflow_scroll.html create mode 100644 test_fixtures/grid/grid_inflow_overflow_visible.html create mode 100644 test_fixtures/leaf/leaf_overflow_clip.html create mode 100644 test_fixtures/leaf/leaf_overflow_clip_with_border.html create mode 100644 test_fixtures/leaf/leaf_overflow_clip_with_border_and_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_clip_with_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_hidden.html create mode 100644 test_fixtures/leaf/leaf_overflow_hidden_with_border.html create mode 100644 test_fixtures/leaf/leaf_overflow_hidden_with_border_and_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_hidden_with_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_scroll.html create mode 100644 test_fixtures/leaf/leaf_overflow_scroll_with_border.html create mode 100644 test_fixtures/leaf/leaf_overflow_scroll_with_border_and_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_scroll_with_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_visible.html create mode 100644 test_fixtures/leaf/leaf_overflow_visible_with_border.html create mode 100644 test_fixtures/leaf/leaf_overflow_visible_with_border_and_padding.html create mode 100644 test_fixtures/leaf/leaf_overflow_visible_with_padding.html create mode 100644 tests/generated/block/block_absolute_overflow_clip.rs create mode 100644 tests/generated/block/block_absolute_overflow_hidden.rs create mode 100644 tests/generated/block/block_absolute_overflow_scroll.rs create mode 100644 tests/generated/block/block_absolute_overflow_visible.rs create mode 100644 tests/generated/block/block_inflow_overflow_clip.rs create mode 100644 tests/generated/block/block_inflow_overflow_hidden.rs create mode 100644 tests/generated/block/block_inflow_overflow_scroll.rs create mode 100644 tests/generated/block/block_inflow_overflow_visible.rs create mode 100644 tests/generated/flex/content_size_with_border.rs create mode 100644 tests/generated/flex/flex_absolute_overflow_clip.rs create mode 100644 tests/generated/flex/flex_absolute_overflow_hidden.rs create mode 100644 tests/generated/flex/flex_absolute_overflow_scroll.rs create mode 100644 tests/generated/flex/flex_absolute_overflow_visible.rs create mode 100644 tests/generated/flex/flex_inflow_overflow_clip.rs create mode 100644 tests/generated/flex/flex_inflow_overflow_hidden.rs create mode 100644 tests/generated/flex/flex_inflow_overflow_scroll.rs create mode 100644 tests/generated/flex/flex_inflow_overflow_visible.rs create mode 100644 tests/generated/grid/grid_absolute_overflow_clip.rs create mode 100644 tests/generated/grid/grid_absolute_overflow_hidden.rs create mode 100644 tests/generated/grid/grid_absolute_overflow_scroll.rs create mode 100644 tests/generated/grid/grid_absolute_overflow_visible.rs create mode 100644 tests/generated/grid/grid_inflow_overflow_clip.rs create mode 100644 tests/generated/grid/grid_inflow_overflow_hidden.rs create mode 100644 tests/generated/grid/grid_inflow_overflow_scroll.rs create mode 100644 tests/generated/grid/grid_inflow_overflow_visible.rs create mode 100644 tests/generated/leaf/leaf_overflow_clip.rs create mode 100644 tests/generated/leaf/leaf_overflow_clip_with_border.rs create mode 100644 tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_clip_with_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_hidden.rs create mode 100644 tests/generated/leaf/leaf_overflow_hidden_with_border.rs create mode 100644 tests/generated/leaf/leaf_overflow_hidden_with_border_and_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_hidden_with_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_scroll.rs create mode 100644 tests/generated/leaf/leaf_overflow_scroll_with_border.rs create mode 100644 tests/generated/leaf/leaf_overflow_scroll_with_border_and_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_scroll_with_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_visible.rs create mode 100644 tests/generated/leaf/leaf_overflow_visible_with_border.rs create mode 100644 tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs create mode 100644 tests/generated/leaf/leaf_overflow_visible_with_padding.rs diff --git a/scripts/gentest/src/main.rs b/scripts/gentest/src/main.rs index 04ade7b7e..9a6f3fc79 100644 --- a/scripts/gentest/src/main.rs +++ b/scripts/gentest/src/main.rs @@ -232,7 +232,9 @@ fn generate_test(name: impl AsRef, description: &Value) -> TokenStream { taffy.print_tree(node); println!(); + let mut mismatches = 0u32; #assertions + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } ) } @@ -270,44 +272,50 @@ fn generate_assertions(ident: &str, node: &Value, use_rounding: bool) -> TokenSt let ident = Ident::new(ident, Span::call_site()); + let gen_check = |expr: TokenStream, expected: f32| { + let cmp = if use_rounding { + quote!(layout.#expr != #expected) + } else { + quote!((layout.#expr - #expected).abs() >= 0.1) + }; + quote!( + if #cmp { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", #ident, stringify!(#expr), #expected, layout.#expr); + } + ) + }; + // The scrollWidth reading from chrome is only accurate if the node is scroll container. So only assert in that case. // TODO: accurately test content size in the non-scroll-container case. - let scroll_assertions = if is_scroll_container { + let scroll_assertions = if is_scroll_container || true { + let check_scroll_width = gen_check(quote!(scroll_width()), scroll_width); + let check_scroll_height = gen_check(quote!(scroll_height()), scroll_height); quote!( #[cfg(feature = "content_size")] - assert_eq!(layout.scroll_width(), #scroll_width, "scroll_width of node {:?}. Expected {}. Actual {}", #ident, #scroll_width, layout.scroll_width()); + #check_scroll_width #[cfg(feature = "content_size")] - assert_eq!(layout.scroll_height(), #scroll_height, "scroll_height of node {:?}. Expected {}. Actual {}", #ident, #scroll_height, layout.scroll_height()); + #check_scroll_height ) } else { quote!() }; - if use_rounding { - quote!( - let layout = taffy.layout(#ident).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, #width, "width of node {:?}. Expected {}. Actual {}", #ident, #width, size.width); - assert_eq!(size.height, #height, "height of node {:?}. Expected {}. Actual {}", #ident, #height, size.height); - assert_eq!(location.x, #x, "x of node {:?}. Expected {}. Actual {}", #ident, #x, location.x); - assert_eq!(location.y, #y, "y of node {:?}. Expected {}. Actual {}", #ident, #y, location.y); - #scroll_assertions - - #children - ) - } else { - quote!( - let layout = taffy.layout(#ident).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - #width).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", #ident, #width, size.width); - assert!((size.height - #height).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", #ident, #height, size.height); - assert!((location.x - #x).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", #ident, #x, location.x); - assert!((location.y - #y).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", #ident, #y, location.y); - #scroll_assertions - - #children - ) - } + let check_width = gen_check(quote!(size.width), width); + let check_height = gen_check(quote!(size.height), height); + let check_x = gen_check(quote!(location.x), x); + let check_y = gen_check(quote!(location.y), y); + + quote!( + let layout = taffy.layout(#ident).unwrap(); + #check_width + #check_height + #check_x + #check_y + #scroll_assertions + + #children + ) } fn generate_node(ident: &str, node: &Value) -> TokenStream { @@ -445,6 +453,8 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream { "hidden" => Some(quote!(taffy::style::Overflow::Hidden)), "scroll" => Some(quote!(taffy::style::Overflow::Scroll)), "auto" => Some(quote!(taffy::style::Overflow::Auto)), + "clip" => Some(quote!(taffy::style::Overflow::Clip)), + "visible" => None, // None defaults to visible. _ => None, }, _ => None, @@ -610,7 +620,8 @@ 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 node_context: Option<_> = text_content.map(|text| generate_node_context(text, writing_mode, raw_aspect_ratio)); + let node_context: Option<_> = + text_content.map(|text| generate_node_context(ident, 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())); @@ -684,8 +695,11 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream { #children_body let #ident = taffy.new_with_children(#style,#children).unwrap(); ) - } else if node_context.is_some() { - quote!(let #ident = taffy.new_leaf_with_context(#style,#node_context,).unwrap();) + } else if let Some((temps, expr)) = node_context { + quote!( + #temps + let #ident = taffy.new_leaf_with_context(#style,#expr,).unwrap(); + ) } else { quote!(let #ident = taffy.new_leaf(#style).unwrap();) } @@ -922,7 +936,12 @@ fn generate_scalar_definition(track_definition: &serde_json::Map) } } -fn generate_node_context(text_content: &str, writing_mode: Option<&str>, aspect_ratio: Option) -> TokenStream { +fn generate_node_context( + node_ident: &str, + text_content: &str, + writing_mode: Option<&str>, + aspect_ratio: Option, +) -> (TokenStream, TokenStream) { let trimmed_text_content = text_content.trim(); let writing_mode_token = match writing_mode { @@ -935,7 +954,20 @@ fn generate_node_context(text_content: &str, writing_mode: Option<&str>, aspect_ None => quote!(None), }; - quote!( - crate::TestNodeContext::ahem_text(#trimmed_text_content, #writing_mode_token) - ) + let string_lit = quote!(#trimmed_text_content); + + // If the string literal is too long, rustfmt gives up on the + // whole line. So pull long string literals out onto their own + // line so that the Style constructor still gets formatted. + if string_lit.to_string().len() > 100 { + let temp = format_ident!("{node_ident}_text"); + (quote!(let #temp = #string_lit;), quote!(crate::TestNodeContext::ahem_text(#temp, #writing_mode_token))) + } else { + ( + quote!(), + quote!( + crate::TestNodeContext::ahem_text(#string_lit, #writing_mode_token) + ), + ) + } } diff --git a/src/compute/block.rs b/src/compute/block.rs index 35f5be89f..66ec1c793 100644 --- a/src/compute/block.rs +++ b/src/compute/block.rs @@ -1,4 +1,6 @@ //! Computes the CSS block layout algorithm in the case that the block container being laid out contains only block-level boxes + +use crate::compute::common::compute_scrollbar_size; use crate::geometry::{Line, Point, Rect, Size}; use crate::style::{AvailableSpace, CoreStyle, LengthPercentageAuto, Overflow, Position}; use crate::style_helpers::TaffyMaxContent; @@ -12,7 +14,7 @@ use crate::util::{MaybeResolve, ResolveOrZero}; use crate::{BlockContainerStyle, BlockItemStyle, BoxGenerationMode, BoxSizing, LayoutBlockContainer, TextAlign}; #[cfg(feature = "content_size")] -use super::common::content_size::compute_content_size_contribution; +use super::common::content_size::expand_scrollable_overflow; /// Per-child data that is accumulated and modified over the course of the layout algorithm struct BlockItem { @@ -134,12 +136,13 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: let aspect_ratio = style.aspect_ratio(); let padding = raw_padding.resolve_or_zero(parent_size.width, |val, basis| tree.calc(val, basis)); let border = raw_border.resolve_or_zero(parent_size.width, |val, basis| tree.calc(val, basis)); + let overflow = style.overflow(); // Scrollbar gutters are reserved when the `overflow` property is set to `Overflow::Scroll`. // However, the axis are switched (transposed) because a node that scrolls vertically needs // *horizontal* space to be reserved for a scrollbar let scrollbar_gutter = { - let offsets = style.overflow().transpose().map(|overflow| match overflow { + let offsets = overflow.transpose().map(|overflow| match overflow { Overflow::Scroll => style.scrollbar_width(), _ => 0.0, }); @@ -169,25 +172,25 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: .maybe_apply_aspect_ratio(aspect_ratio) .maybe_add(box_sizing_adjustment); + // Is this a scroll container? + let is_scroll_container = overflow.x.is_scroll_container() || overflow.y.is_scroll_container(); + // Determine margin collapsing behaviour let own_margins_collapse_with_children = Line { start: vertical_margins_are_collapsible.start - && !style.overflow().x.is_scroll_container() - && !style.overflow().y.is_scroll_container() + && !is_scroll_container && style.position() == Position::Relative && padding.top == 0.0 && border.top == 0.0, end: vertical_margins_are_collapsible.end - && !style.overflow().x.is_scroll_container() - && !style.overflow().y.is_scroll_container() + && !is_scroll_container && style.position() == Position::Relative && padding.bottom == 0.0 && border.bottom == 0.0 && size.height.is_none(), }; let has_styles_preventing_being_collapsed_through = !style.is_block() - || style.overflow().x.is_scroll_container() - || style.overflow().y.is_scroll_container() + || is_scroll_container || style.position() == Position::Absolute || padding.top > 0.0 || padding.bottom > 0.0 @@ -220,7 +223,15 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: let resolved_padding = raw_padding.resolve_or_zero(Some(container_outer_width), |val, basis| tree.calc(val, basis)); let resolved_border = raw_border.resolve_or_zero(Some(container_outer_width), |val, basis| tree.calc(val, basis)); let resolved_content_box_inset = resolved_padding + resolved_border + scrollbar_gutter; - let (inflow_content_size, intrinsic_outer_height, first_child_top_margin_set, last_child_bottom_margin_set) = + + #[cfg(feature = "content_size")] + let scroll_origin = resolved_border.top_left(); + + // Accumulator for the descendent's scrollable overflow. + #[cfg(feature = "content_size")] + let mut descendent_scrollable_overflow = Rect::new_empty(); + + let (intrinsic_outer_height, first_child_top_margin_set, last_child_bottom_margin_set) = perform_final_layout_on_in_flow_children( tree, &mut items, @@ -229,7 +240,21 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: resolved_content_box_inset, text_align, own_margins_collapse_with_children, + #[cfg(feature = "content_size")] + &mut descendent_scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, ); + + // If we are a scroll container, inflate the inflow scrollable + // overflow by our padding. This only applys to inflow children + // so we do it here before adding the out-of-flow (absolute) + // children. + #[cfg(feature = "content_size")] + if is_scroll_container { + descendent_scrollable_overflow = descendent_scrollable_overflow.inset_by(-resolved_padding); + } + let container_outer_height = known_dimensions .height .unwrap_or(intrinsic_outer_height.maybe_clamp(min_size.height, max_size.height)) @@ -244,9 +269,17 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: // 4. Layout absolutely positioned children let absolute_position_inset = resolved_border + scrollbar_gutter; let absolute_position_area = final_outer_size - absolute_position_inset.sum_axes(); - let absolute_position_offset = Point { x: absolute_position_inset.left, y: absolute_position_inset.top }; - let absolute_content_size = - perform_absolute_layout_on_absolute_children(tree, &items, absolute_position_area, absolute_position_offset); + let absolute_position_offset = absolute_position_inset.top_left(); + perform_absolute_layout_on_absolute_children( + tree, + &items, + absolute_position_area, + absolute_position_offset, + #[cfg(feature = "content_size")] + &mut descendent_scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, + ); // 5. Perform hidden layout on hidden children let len = tree.child_count(node_id); @@ -271,13 +304,10 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: let can_be_collapsed_through = !has_styles_preventing_being_collapsed_through && all_in_flow_children_can_be_collapsed_through; - #[cfg_attr(not(feature = "content_size"), allow(unused_variables))] - let content_size = inflow_content_size.f32_max(absolute_content_size); - LayoutOutput { size: final_outer_size, #[cfg(feature = "content_size")] - content_size, + descendent_scrollable_overflow, first_baselines: Point::NONE, top_margin: if own_margins_collapse_with_children.start { first_child_top_margin_set @@ -398,15 +428,15 @@ fn perform_final_layout_on_in_flow_children( resolved_content_box_inset: Rect, text_align: TextAlign, own_margins_collapse_with_children: Line, -) -> (Size, f32, CollapsibleMarginSet, CollapsibleMarginSet) { + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] container_scroll_origin: Point, +) -> (f32, CollapsibleMarginSet, CollapsibleMarginSet) { // Resolve container_inner_width for sizing child nodes using initial content_box_inset let container_inner_width = container_outer_width - content_box_inset.horizontal_axis_sum(); let parent_size = Size { width: Some(container_outer_width), height: None }; let available_space = Size { width: AvailableSpace::Definite(container_inner_width), height: AvailableSpace::MinContent }; - #[cfg_attr(not(feature = "content_size"), allow(unused_mut))] - let mut inflow_content_size = Size::ZERO; let mut committed_y_offset = resolved_content_box_inset.top; let mut y_offset_for_absolute = resolved_content_box_inset.top; let mut first_child_top_margin_set = CollapsibleMarginSet::ZERO; @@ -510,10 +540,20 @@ fn perform_final_layout_on_in_flow_children( } } - let scrollbar_size = Size { - width: if item.overflow.y == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - height: if item.overflow.x == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - }; + let scrollbar_size = compute_scrollbar_size( + item.overflow, + item_layout.size, + item.padding, + item.border, + item.scrollbar_width, + ); + + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add + // the resultant padding box to the scrollable overflow. + let scrollable_overflow = item_layout + .descendent_scrollable_overflow + .union(Rect::from_origin_and_size(item_layout.size).inset_by(item.border).shrunk_by(scrollbar_size)); tree.set_unrounded_layout( item.node_id, @@ -521,7 +561,7 @@ fn perform_final_layout_on_in_flow_children( order: item.order, size: item_layout.size, #[cfg(feature = "content_size")] - content_size: item_layout.content_size, + scrollable_overflow, scrollbar_size, location, padding: item.padding, @@ -531,14 +571,16 @@ fn perform_final_layout_on_in_flow_children( ); #[cfg(feature = "content_size")] - { - inflow_content_size = inflow_content_size.f32_max(compute_content_size_contribution( - location, - final_size, - item_layout.content_size, - item.overflow, - )); - } + expand_scrollable_overflow( + container_scrollable_overflow, + container_scroll_origin, + location, + final_size, + item.border, + scrollbar_size, + item.overflow, + scrollable_overflow, + ); // Update first_child_top_margin_set if is_collapsing_with_first_margin_set { @@ -572,7 +614,7 @@ fn perform_final_layout_on_in_flow_children( committed_y_offset += resolved_content_box_inset.bottom + bottom_y_margin_offset; let content_height = f32_max(0.0, committed_y_offset); - (inflow_content_size, content_height, first_child_top_margin_set, last_child_bottom_margin_set) + (content_height, first_child_top_margin_set, last_child_bottom_margin_set) } /// Perform absolute layout on all absolutely positioned children. @@ -582,13 +624,12 @@ fn perform_absolute_layout_on_absolute_children( items: &[BlockItem], area_size: Size, area_offset: Point, -) -> Size { + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] container_scroll_origin: Point, +) { let area_width = area_size.width; let area_height = area_size.height; - #[cfg_attr(not(feature = "content_size"), allow(unused_mut))] - let mut absolute_content_size = Size::ZERO; - for item in items.iter().filter(|item| item.position == Position::Absolute) { let child_style = tree.get_block_child_style(item.node_id); @@ -751,12 +792,15 @@ fn perform_absolute_layout_on_absolute_children( .maybe_add(area_offset.y) .unwrap_or(item.static_position.y + resolved_margin.top), }; - // Note: axis intentionally switched here as scrollbars take up space in the opposite axis - // to the axis in which scrolling is enabled. - let scrollbar_size = Size { - width: if item.overflow.y == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - height: if item.overflow.x == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - }; + + let scrollbar_size = compute_scrollbar_size(item.overflow, final_size, padding, border, item.scrollbar_width); + + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add the + // resultant padding box to the scrollable overflow. + let scrollable_overflow = layout_output + .descendent_scrollable_overflow + .union(Rect::from_top_left_and_size(border.top_left(), final_size - (border.sum_axes() + scrollbar_size))); tree.set_unrounded_layout( item.node_id, @@ -764,7 +808,7 @@ fn perform_absolute_layout_on_absolute_children( order: item.order, size: final_size, #[cfg(feature = "content_size")] - content_size: layout_output.content_size, + scrollable_overflow, scrollbar_size, location, padding, @@ -774,15 +818,15 @@ fn perform_absolute_layout_on_absolute_children( ); #[cfg(feature = "content_size")] - { - absolute_content_size = absolute_content_size.f32_max(compute_content_size_contribution( - location, - final_size, - layout_output.content_size, - item.overflow, - )); - } + expand_scrollable_overflow( + container_scrollable_overflow, + container_scroll_origin, + location, + final_size, + border, + scrollbar_size, + item.overflow, + scrollable_overflow, + ); } - - absolute_content_size } diff --git a/src/compute/common/content_size.rs b/src/compute/common/content_size.rs index 8dfbfa87b..45ceb1b7d 100644 --- a/src/compute/common/content_size.rs +++ b/src/compute/common/content_size.rs @@ -1,32 +1,84 @@ //! Generic CSS content size code that is shared between all CSS algorithms. -use crate::geometry::{Point, Size}; +use crate::geometry::{Point, Rect, Size}; use crate::style::Overflow; -use crate::util::sys::f32_max; - -#[inline(always)] -/// Determine how much width/height a given node contributes to it's parent's content size -pub(crate) fn compute_content_size_contribution( - location: Point, - size: Size, - content_size: Size, - overflow: Point, -) -> Size { - let size_content_size_contribution = Size { - width: match overflow.x { - Overflow::Visible => f32_max(size.width, content_size.width), - _ => size.width, - }, - height: match overflow.y { - Overflow::Visible => f32_max(size.height, content_size.height), - _ => size.height, - }, - }; - if size_content_size_contribution.width > 0.0 && size_content_size_contribution.height > 0.0 { - Size { - width: location.x + size_content_size_contribution.width, - height: location.y + size_content_size_contribution.height, - } - } else { - Size::ZERO + +pub(crate) fn expand_scrollable_overflow( + container_scrollable_overflow: &mut Rect, + container_scroll_origin: Point, + + item_location: Point, + item_size: Size, + item_border: Rect, + item_scrollbar_gutter: Size, + item_overflow: Point, + item_scrollable_overflow: Rect, +) { + let item_rect = Rect::from_top_left_and_size(item_location, item_size); + + // From CSS Overflow 3, section 2.2: + // The scrollable overflow area is the union of: + // ... + // - The border boxes of all boxes for which it is the + // containing block and whose border boxes are positioned not + // wholly in the unreachable scrollable overflow region, + // accounting for transforms by projecting each box onto the + // plane of the element that establishes its 3D rendering + // context. [CSS3-TRANSFORMS] + if item_rect.right < container_scroll_origin.x || item_rect.bottom < container_scroll_origin.y { + return; + } + + // From CSS Overflow 3, section 2.2: + // The scrollable overflow area is the union of: + // ... + // Border boxes with zero area do not affect the scrollable + // overflow area. + if item_size.has_non_zero_area() { + container_scrollable_overflow.union_with(item_rect); + } + + // From CSS Overflow 3, section 2.2: + // The scrollable overflow area is the union of: + // ... + // - The margin areas of grid item and flex item boxes for + // which the box establishes a containing block. + + // TODO: open questions: + // - what does this mean? + // - is this predicated the same as the previous item? + // - assuming the margins are positive, don't this subsume the + // previous item? + + // From CSS Overflow 3, section 2.2: + // The scrollable overflow area is the union of: + // ... + // - The scrollable overflow areas of all of the above boxes + // (including zero-area boxes and accounting for + // transforms as described above), provided they + // themselves have overflow: visible (i.e. do not + // themselves trap the overflow) and that scrollable + // overflow is not already clipped (e.g. by the clip + // property or the contain property). + // + // TODO: Account for clip and contain properties. + + let item_clip_rect = item_rect.shrunk_by(item_scrollbar_gutter).inset_by(item_border); + + let mut positioned_overflow = item_scrollable_overflow.offset_by(item_location.into()); + + if match item_overflow { + Point { x: Overflow::Visible, y: Overflow::Visible } => true, + Point { x: Overflow::Visible, y: Overflow::Clip } => positioned_overflow.clip_against_y(item_clip_rect), + Point { x: Overflow::Clip, y: Overflow::Visible } => positioned_overflow.clip_against_x(item_clip_rect), + // From CSS Overflow 3, section 3.1: + // The visible/clip values of overflow compute to + // auto/hidden (respectively) if one of overflow-x or + // overflow-y is neither visible nor clip. + // + // Therefore all other pairs compute to auto, hidden, + // or clip--and hence do not have overflow: visible. + _ => false, + } { + container_scrollable_overflow.union_with(positioned_overflow); } } diff --git a/src/compute/common/mod.rs b/src/compute/common/mod.rs index d34eddb6d..4e976c016 100644 --- a/src/compute/common/mod.rs +++ b/src/compute/common/mod.rs @@ -1,5 +1,35 @@ //! Generic code that is shared between multiple layout algorithms + +use crate::{ + geometry::{Point, Rect, Size}, + style::Overflow, +}; + pub(crate) mod alignment; #[cfg(feature = "content_size")] pub(crate) mod content_size; + +/// Return the widths of the scrollbars present for the particular +/// `Overflow` factoring in that the scrollbars can't cause the +/// dimensions of the content rectange to go negative. +pub(crate) fn compute_scrollbar_size( + overflow: Point, + outer_size: Size, + padding: Rect, + border: Rect, + scrollbar_width: f32, +) -> Size { + // Earlier stuff is supposed to inflate outer_size enough to hold + // padding and border, but clamp the value at zero just in case. + let avail = outer_size - (padding + border).sum_axes().map(|val| val.max(0.0)); + // Scrollbars consume space on the perpendicular axis, hence the + // `.transpose()`. + Size::from(overflow.transpose()).zip_map(avail, |overflow, avail| { + if overflow == Overflow::Scroll { + avail.min(scrollbar_width) + } else { + 0.0 + } + }) +} diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs index 384e9f530..74b000331 100644 --- a/src/compute/flexbox.rs +++ b/src/compute/flexbox.rs @@ -1,5 +1,8 @@ //! Computes the [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) layout algorithm on [`TaffyTree`](crate::TaffyTree) according to the [spec](https://www.w3.org/TR/css-flexbox-1/) -use crate::compute::common::alignment::compute_alignment_offset; +use crate::compute::common::{ + alignment::{apply_alignment_fallback, compute_alignment_offset}, + compute_scrollbar_size, +}; use crate::geometry::{Line, Point, Rect, Size}; use crate::style::{ AlignContent, AlignItems, AlignSelf, AvailableSpace, FlexWrap, JustifyContent, LengthPercentageAuto, Overflow, @@ -15,9 +18,8 @@ use crate::util::MaybeMath; use crate::util::{MaybeResolve, ResolveOrZero}; use crate::{BoxGenerationMode, BoxSizing}; -use super::common::alignment::apply_alignment_fallback; #[cfg(feature = "content_size")] -use super::common::content_size::compute_content_size_contribution; +use super::common::content_size::expand_scrollable_overflow; /// The intermediate results of a flexbox calculation for a single item struct FlexItem { @@ -135,11 +137,18 @@ struct AlgoConstants { margin: Rect, /// The border of this section border: Rect, + /// The padding of this section + #[cfg(feature = "content_size")] + padding: Rect, /// The space between the content box and the border box. /// This consists of padding + border + scrollbar_gutter. content_box_inset: Rect, + /// True iff this is a scroll container (i.e. either overflow + /// value is auto, scroll, or hidden). + #[cfg(feature = "content_size")] + is_scroll_container: bool, /// The size reserved for scrollbar gutters in each axis - scrollbar_gutter: Point, + scrollbar_gutter: Size, /// The gap of this section gap: Size, /// The align_items property of this node @@ -364,13 +373,56 @@ fn compute_preliminary(tree: &mut impl LayoutFlexboxContainer, node: NodeId, inp debug_log!("align_flex_lines_per_align_content"); align_flex_lines_per_align_content(&mut flex_lines, &constants, total_line_cross_size); + #[cfg(feature = "content_size")] + let padding_box = Rect::from_origin_and_size(constants.container_size) + .inset_by(constants.border) + .shrunk_by(constants.scrollbar_gutter); + + // The origin of the scrolling region. Nominally the upper-left + // of the padding box, but can be adjusted to accomodate + // `place-content: start` and `place-content: end` alignment. + // (That detail is not yet implemented.) + #[cfg(feature = "content_size")] + let scroll_origin: Point = padding_box.top_left(); + + // Accumulator for the scrollable content inherited from children. + // Adding our padding box only happens once our final size has + // been picked by the container we are inside. + #[cfg(feature = "content_size")] + let mut scrollable_overflow = Rect::new_empty(); + // Do a final layout pass and gather the resulting layouts debug_log!("final_layout_pass"); - let inflow_content_size = final_layout_pass(tree, &mut flex_lines, &constants); + final_layout_pass( + tree, + &mut flex_lines, + &constants, + #[cfg(feature = "content_size")] + &mut scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, + ); + + #[cfg(feature = "content_size")] + // If we are a scroll container, inflate the inflow scrollable + // overflow by our padding. This only applys to inflow children + // so we do it here before adding the out-of-flow (absolute) + // children. + if constants.is_scroll_container { + scrollable_overflow = scrollable_overflow.inset_by(-constants.padding); + } // Before returning we perform absolute layout on all absolutely positioned children debug_log!("perform_absolute_layout_on_absolute_children"); - let absolute_content_size = perform_absolute_layout_on_absolute_children(tree, node, &constants); + perform_absolute_layout_on_absolute_children( + tree, + node, + &constants, + #[cfg(feature = "content_size")] + &mut scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, + ); debug_log!("hidden_layout"); let len = tree.child_count(node); @@ -407,7 +459,8 @@ fn compute_preliminary(tree: &mut impl LayoutFlexboxContainer, node: NodeId, inp LayoutOutput::from_sizes_and_baselines( constants.container_size, - inflow_content_size.f32_max(absolute_content_size), + #[cfg(feature = "content_size")] + scrollable_overflow, Point { x: None, y: first_vertical_baseline }, ) } @@ -438,17 +491,18 @@ fn compute_constants( let align_content = style.align_content().unwrap_or(AlignContent::Stretch); let justify_content = style.justify_content(); + let overflow = style.overflow(); + #[cfg(feature = "content_size")] + let is_scroll_container = overflow.x.is_scroll_container() | overflow.y.is_scroll_container(); // Scrollbar gutters are reserved when the `overflow` property is set to `Overflow::Scroll`. // However, the axis are switched (transposed) because a node that scrolls vertically needs // *horizontal* space to be reserved for a scrollbar - let scrollbar_gutter = style.overflow().transpose().map(|overflow| match overflow { + let scrollbar_gutter = Size::from(overflow.transpose().map(|overflow| match overflow { Overflow::Scroll => style.scrollbar_width(), _ => 0.0, - }); + })); // TODO: make side configurable based on the `direction` property - let mut content_box_inset = padding + border; - content_box_inset.right += scrollbar_gutter.x; - content_box_inset.bottom += scrollbar_gutter.y; + let content_box_inset = padding + border + Rect::from_origin_and_size(scrollbar_gutter); let node_outer_size = known_dimensions; let node_inner_size = node_outer_size.maybe_sub(content_box_inset.sum_axes()); @@ -475,8 +529,12 @@ fn compute_constants( .maybe_add(box_sizing_adjustment), margin, border, + #[cfg(feature = "content_size")] + padding, gap, content_box_inset, + #[cfg(feature = "content_size")] + is_scroll_container, scrollbar_gutter, align_items, align_content, @@ -1883,10 +1941,11 @@ fn calculate_flex_item( total_offset_main: &mut f32, total_offset_cross: f32, line_offset_cross: f32, - #[cfg(feature = "content_size")] total_content_size: &mut Size, container_size: Size, node_inner_size: Size>, direction: FlexDirection, + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] container_scroll_origin: Point, ) { let layout_output = tree.perform_child_layout( item.node, @@ -1896,12 +1955,7 @@ fn calculate_flex_item( SizingMode::ContentSize, Line::FALSE, ); - let LayoutOutput { - size, - #[cfg(feature = "content_size")] - content_size, - .. - } = layout_output; + let size = layout_output.size; let offset_main = *total_offset_main + item.offset_main @@ -1928,10 +1982,15 @@ fn calculate_flex_item( true => Point { x: offset_main, y: offset_cross }, false => Point { x: offset_cross, y: offset_main }, }; - let scrollbar_size = Size { - width: if item.overflow.y == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - height: if item.overflow.x == Overflow::Scroll { item.scrollbar_width } else { 0.0 }, - }; + + let scrollbar_size = compute_scrollbar_size(item.overflow, size, item.padding, item.border, item.scrollbar_width); + + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add the + // resultant padding box to the scrollable overflow. + let scrollable_overflow = layout_output + .descendent_scrollable_overflow + .union(Rect::from_origin_and_size(size).inset_by(item.border).shrunk_by(scrollbar_size)); tree.set_unrounded_layout( item.node, @@ -1939,7 +1998,7 @@ fn calculate_flex_item( order: item.order, size, #[cfg(feature = "content_size")] - content_size, + scrollable_overflow, scrollbar_size, location, padding: item.padding, @@ -1951,10 +2010,16 @@ fn calculate_flex_item( *total_offset_main += item.offset_main + item.margin.main_axis_sum(direction) + size.main(direction); #[cfg(feature = "content_size")] - { - *total_content_size = - total_content_size.f32_max(compute_content_size_contribution(location, size, content_size, item.overflow)); - } + expand_scrollable_overflow( + container_scrollable_overflow, + container_scroll_origin, + location, + size, + item.border, + scrollbar_size, + item.overflow, + scrollable_overflow, + ); } /// Calculates the layout line @@ -1963,11 +2028,12 @@ fn calculate_layout_line( tree: &mut impl LayoutFlexboxContainer, line: &mut FlexLine, total_offset_cross: &mut f32, - #[cfg(feature = "content_size")] content_size: &mut Size, container_size: Size, node_inner_size: Size>, padding_border: Rect, direction: FlexDirection, + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] container_scroll_origin: Point, ) { let mut total_offset_main = padding_border.main_start(direction); let line_offset_cross = line.offset_cross; @@ -1980,11 +2046,13 @@ fn calculate_layout_line( &mut total_offset_main, *total_offset_cross, line_offset_cross, - #[cfg(feature = "content_size")] - content_size, container_size, node_inner_size, direction, + #[cfg(feature = "content_size")] + container_scrollable_overflow, + #[cfg(feature = "content_size")] + container_scroll_origin, ); } } else { @@ -1995,11 +2063,13 @@ fn calculate_layout_line( &mut total_offset_main, *total_offset_cross, line_offset_cross, - #[cfg(feature = "content_size")] - content_size, container_size, node_inner_size, direction, + #[cfg(feature = "content_size")] + container_scrollable_overflow, + #[cfg(feature = "content_size")] + container_scroll_origin, ); } } @@ -2013,24 +2083,25 @@ fn final_layout_pass( tree: &mut impl LayoutFlexboxContainer, flex_lines: &mut [FlexLine], constants: &AlgoConstants, -) -> Size { + #[cfg(feature = "content_size")] scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] scroll_origin: Point, +) { let mut total_offset_cross = constants.content_box_inset.cross_start(constants.dir); - #[cfg_attr(not(feature = "content_size"), allow(unused_mut))] - let mut content_size = Size::ZERO; - if constants.is_wrap_reverse { for line in flex_lines.iter_mut().rev() { calculate_layout_line( tree, line, &mut total_offset_cross, - #[cfg(feature = "content_size")] - &mut content_size, constants.container_size, constants.node_inner_size, constants.content_box_inset, constants.dir, + #[cfg(feature = "content_size")] + scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, ); } } else { @@ -2039,20 +2110,17 @@ fn final_layout_pass( tree, line, &mut total_offset_cross, - #[cfg(feature = "content_size")] - &mut content_size, constants.container_size, constants.node_inner_size, constants.content_box_inset, constants.dir, + #[cfg(feature = "content_size")] + scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, ); } } - - content_size.width += constants.content_box_inset.right - constants.border.right - constants.scrollbar_gutter.x; - content_size.height += constants.content_box_inset.bottom - constants.border.bottom - constants.scrollbar_gutter.y; - - content_size } /// Perform absolute layout on all absolutely positioned children. @@ -2061,15 +2129,14 @@ fn perform_absolute_layout_on_absolute_children( tree: &mut impl LayoutFlexboxContainer, node: NodeId, constants: &AlgoConstants, -) -> Size { + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] scroll_origin: Point, +) { let container_width = constants.container_size.width; let container_height = constants.container_size.height; let inset_relative_size = constants.container_size - constants.border.sum_axes() - constants.scrollbar_gutter.into(); - #[cfg_attr(not(feature = "content_size"), allow(unused_mut))] - let mut content_size = Size::ZERO; - for order in 0..tree.child_count(node) { let child = tree.get_child_id(node, order); let child_style = tree.get_flexbox_child_style(child); @@ -2288,17 +2355,23 @@ fn perform_absolute_layout_on_absolute_children( true => Point { x: offset_main, y: offset_cross }, false => Point { x: offset_cross, y: offset_main }, }; - let scrollbar_size = Size { - width: if overflow.y == Overflow::Scroll { scrollbar_width } else { 0.0 }, - height: if overflow.x == Overflow::Scroll { scrollbar_width } else { 0.0 }, - }; + + let scrollbar_size = compute_scrollbar_size(overflow, final_size, padding, border, scrollbar_width); + + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add the + // resultant padding box to the scrollable overflow. + let scrollable_overflow = layout_output + .descendent_scrollable_overflow + .union(Rect::from_origin_and_size(final_size).inset_by(border).shrunk_by(scrollbar_size)); + tree.set_unrounded_layout( child, &Layout { order: order as u32, size: final_size, #[cfg(feature = "content_size")] - content_size: layout_output.content_size, + scrollable_overflow, scrollbar_size, location, padding, @@ -2308,28 +2381,17 @@ fn perform_absolute_layout_on_absolute_children( ); #[cfg(feature = "content_size")] - { - let size_content_size_contribution = Size { - width: match overflow.x { - Overflow::Visible => f32_max(final_size.width, layout_output.content_size.width), - _ => final_size.width, - }, - height: match overflow.y { - Overflow::Visible => f32_max(final_size.height, layout_output.content_size.height), - _ => final_size.height, - }, - }; - if size_content_size_contribution.has_non_zero_area() { - let content_size_contribution = Size { - width: location.x + size_content_size_contribution.width, - height: location.y + size_content_size_contribution.height, - }; - content_size = content_size.f32_max(content_size_contribution); - } - } + expand_scrollable_overflow( + container_scrollable_overflow, + scroll_origin, + location, + final_size, + border, + scrollbar_size, + overflow, + scrollable_overflow, + ); } - - content_size } /// Computes the total space taken up by gaps in an axis given: diff --git a/src/compute/grid/alignment.rs b/src/compute/grid/alignment.rs index 68303f9bc..1d0b8c12a 100644 --- a/src/compute/grid/alignment.rs +++ b/src/compute/grid/alignment.rs @@ -1,15 +1,16 @@ //! Alignment of tracks and final positioning of items use super::types::GridTrack; use crate::compute::common::alignment::{apply_alignment_fallback, compute_alignment_offset}; +use crate::compute::common::compute_scrollbar_size; use crate::geometry::{InBothAbsAxis, Line, Point, Rect, Size}; -use crate::style::{AlignContent, AlignItems, AlignSelf, AvailableSpace, CoreStyle, GridItemStyle, Overflow, Position}; +use crate::style::{AlignContent, AlignItems, AlignSelf, AvailableSpace, CoreStyle, GridItemStyle, Position}; use crate::tree::{Layout, LayoutPartialTreeExt, NodeId, SizingMode}; use crate::util::sys::f32_max; use crate::util::{MaybeMath, MaybeResolve, ResolveOrZero}; +use crate::{BoxSizing, LayoutGridContainer}; #[cfg(feature = "content_size")] -use crate::compute::common::content_size::compute_content_size_contribution; -use crate::{BoxSizing, LayoutGridContainer}; +use crate::compute::common::content_size::expand_scrollable_overflow; /// Align the grid tracks within the grid according to the align-content (rows) or /// justify-content (columns) property. This only does anything if the size of the @@ -63,7 +64,10 @@ pub(super) fn align_and_position_item( grid_area: Rect, container_alignment_styles: InBothAbsAxis>, baseline_shim: f32, -) -> (Size, f32, f32) { + + #[cfg(feature = "content_size")] container_scrollable_overflow: &mut Rect, + #[cfg(feature = "content_size")] container_scroll_origin: Point, +) -> (f32, f32) { let grid_area_size = Size { width: grid_area.right - grid_area.left, height: grid_area.bottom - grid_area.top }; let style = tree.get_grid_child_style(node); @@ -209,12 +213,12 @@ pub(super) fn align_and_position_item( ); // Resolve final size - let Size { width, height } = Size { width, height }.unwrap_or(layout_output.size).maybe_clamp(min_size, max_size); + let size = Size { width, height }.unwrap_or(layout_output.size).maybe_clamp(min_size, max_size); let (x, x_margin) = align_item_within_area( Line { start: grid_area.left, end: grid_area.right }, justify_self.unwrap_or(alignment_styles.horizontal), - width, + size.width, position, inset_horizontal, margin.horizontal_components(), @@ -223,28 +227,32 @@ pub(super) fn align_and_position_item( let (y, y_margin) = align_item_within_area( Line { start: grid_area.top, end: grid_area.bottom }, align_self.unwrap_or(alignment_styles.vertical), - height, + size.height, position, inset_vertical, margin.vertical_components(), baseline_shim, ); - let scrollbar_size = Size { - width: if overflow.y == Overflow::Scroll { scrollbar_width } else { 0.0 }, - height: if overflow.x == Overflow::Scroll { scrollbar_width } else { 0.0 }, - }; + let scrollbar_size = compute_scrollbar_size(overflow, size, padding, border, scrollbar_width); let resolved_margin = Rect { left: x_margin.start, right: x_margin.end, top: y_margin.start, bottom: y_margin.end }; + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add the + // resultant padding box to the scrollable overflow. + let scrollable_overflow = layout_output + .descendent_scrollable_overflow + .union(Rect::from_origin_and_size(size).inset_by(border).shrunk_by(scrollbar_size)); + tree.set_unrounded_layout( node, &Layout { order, location: Point { x, y }, - size: Size { width, height }, + size, #[cfg(feature = "content_size")] - content_size: layout_output.content_size, + scrollable_overflow, scrollbar_size, padding, border, @@ -253,12 +261,18 @@ pub(super) fn align_and_position_item( ); #[cfg(feature = "content_size")] - let contribution = - compute_content_size_contribution(Point { x, y }, Size { width, height }, layout_output.content_size, overflow); - #[cfg(not(feature = "content_size"))] - let contribution = Size::ZERO; + expand_scrollable_overflow( + container_scrollable_overflow, + container_scroll_origin, + Point { x, y }, + size, + border, + scrollbar_size, + overflow, + scrollable_overflow, + ); - (contribution, y, height) + (y, size.height) } /// Align and size a grid item along a single axis diff --git a/src/compute/grid/mod.rs b/src/compute/grid/mod.rs index a9a3ab089..d67de557d 100644 --- a/src/compute/grid/mod.rs +++ b/src/compute/grid/mod.rs @@ -82,10 +82,15 @@ pub fn compute_grid_layout( // Scrollbar gutters are reserved when the `overflow` property is set to `Overflow::Scroll`. // However, the axis are switched (transposed) because a node that scrolls vertically needs // *horizontal* space to be reserved for a scrollbar - let scrollbar_gutter = style.overflow().transpose().map(|overflow| match overflow { + let overflow = style.overflow(); + let scrollbar_gutter = overflow.transpose().map(|overflow| match overflow { Overflow::Scroll => style.scrollbar_width(), _ => 0.0, }); + + #[cfg(feature = "content_size")] + let is_scroll_container = overflow.x.is_scroll_container() | overflow.y.is_scroll_container(); + // TODO: make side configurable based on the `direction` property let mut content_box_inset = padding_border; content_box_inset.right += scrollbar_gutter.x; @@ -491,8 +496,14 @@ pub fn compute_grid_layout( // 9. Size, Align, and Position Grid Items - #[cfg_attr(not(feature = "content_size"), allow(unused_mut))] - let mut item_content_size_contribution = Size::ZERO; + #[cfg(feature = "content_size")] + let scroll_origin = border.top_left(); + + // Accumulator for the scrollable content inherited from children. + // Adding our padding box only happens once our final size has + // been picked by the container we are inside. + #[cfg(feature = "content_size")] + let mut scrollable_overflow = Rect::new_empty(); // Sort items back into original order to allow them to be matched up with styles items.sort_by_key(|item| item.source_order); @@ -507,22 +518,29 @@ pub fn compute_grid_layout( left: columns[item.column_indexes.start as usize + 1].offset, right: columns[item.column_indexes.end as usize].offset, }; - #[cfg_attr(not(feature = "content_size"), allow(unused_variables))] - let (content_size_contribution, y_position, height) = align_and_position_item( + let (y_position, height) = align_and_position_item( tree, item.node, index as u32, grid_area, container_alignment_styles, item.baseline_shim, + #[cfg(feature = "content_size")] + &mut scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, ); item.y_position = y_position; item.height = height; + } - #[cfg(feature = "content_size")] - { - item_content_size_contribution = item_content_size_contribution.f32_max(content_size_contribution); - } + // If we are a scroll container, inflate the inflow scrollable + // overflow by our padding. This only applys to inflow children + // so we do it here before adding the out-of-flow (absolute) + // children. + #[cfg(feature = "content_size")] + if is_scroll_container { + scrollable_overflow = scrollable_overflow.inset_by(-padding); } // Position hidden and absolutely positioned children @@ -583,13 +601,18 @@ pub fn compute_grid_layout( drop(child_style); // TODO: Baseline alignment support for absolutely positioned items (should check if is actually specified) - #[cfg_attr(not(feature = "content_size"), allow(unused_variables))] - let (content_size_contribution, _, _) = - align_and_position_item(tree, child, order, grid_area, container_alignment_styles, 0.0); - #[cfg(feature = "content_size")] - { - item_content_size_contribution = item_content_size_contribution.f32_max(content_size_contribution); - } + align_and_position_item( + tree, + child, + order, + grid_area, + container_alignment_styles, + 0.0, + #[cfg(feature = "content_size")] + &mut scrollable_overflow, + #[cfg(feature = "content_size")] + scroll_origin, + ); order += 1; } @@ -608,7 +631,11 @@ pub fn compute_grid_layout( // If there are not items then return just the container size (no baseline) if items.is_empty() { - return LayoutOutput::from_outer_size(container_border_box); + return LayoutOutput::from_size_and_overflow( + container_border_box, + #[cfg(feature = "content_size")] + scrollable_overflow, + ); } // Determine the grid container baseline(s) (currently we only compute the first baseline) @@ -636,7 +663,8 @@ pub fn compute_grid_layout( LayoutOutput::from_sizes_and_baselines( container_border_box, - item_content_size_contribution, + #[cfg(feature = "content_size")] + scrollable_overflow, Point { x: None, y: Some(grid_container_baseline) }, ) } diff --git a/src/compute/leaf.rs b/src/compute/leaf.rs index 4f1d979cd..773eecbb8 100644 --- a/src/compute/leaf.rs +++ b/src/compute/leaf.rs @@ -11,6 +11,9 @@ use crate::util::{MaybeResolve, ResolveOrZero}; use crate::{BoxSizing, CoreStyle}; use core::unreachable; +#[cfg(feature = "content_size")] +use crate::geometry::Rect; + /// Compute the size of a leaf node (node with no children) pub fn compute_leaf_layout( inputs: LayoutInput, @@ -64,7 +67,9 @@ where // Scrollbar gutters are reserved when the `overflow` property is set to `Overflow::Scroll`. // However, the axis are switched (transposed) because a node that scrolls vertically needs // *horizontal* space to be reserved for a scrollbar - let scrollbar_gutter = style.overflow().transpose().map(|overflow| match overflow { + let overflow = style.overflow(); + let is_scroll_container = overflow.x.is_scroll_container() || overflow.y.is_scroll_container(); + let scrollbar_gutter = overflow.transpose().map(|overflow| match overflow { Overflow::Scroll => style.scrollbar_width(), _ => 0.0, }); @@ -74,8 +79,7 @@ where content_box_inset.bottom += scrollbar_gutter.y; let has_styles_preventing_being_collapsed_through = !style.is_block() - || style.overflow().x.is_scroll_container() - || style.overflow().y.is_scroll_container() + || is_scroll_container || style.position() == Position::Absolute || padding.top > 0.0 || padding.bottom > 0.0 @@ -95,16 +99,8 @@ where let size = Size { width, height } .maybe_clamp(node_min_size, node_max_size) .maybe_max(padding_border.sum_axes().map(Some)); - return LayoutOutput { - size, - #[cfg(feature = "content_size")] - content_size: Size::ZERO, - first_baselines: Point::NONE, - top_margin: CollapsibleMarginSet::ZERO, - bottom_margin: CollapsibleMarginSet::ZERO, - margins_can_collapse_through: false, - }; - }; + return LayoutOutput { size, ..LayoutOutput::DEFAULT }; + } } // Compute available space @@ -148,12 +144,19 @@ where width: clamped_size.width, height: f32_max(clamped_size.height, aspect_ratio.map(|ratio| clamped_size.width / ratio).unwrap_or(0.0)), }; - let size = size.maybe_max(padding_border.sum_axes().map(Some)); + let size = size.f32_max(padding_border.sum_axes()); + + #[cfg(feature = "content_size")] + let descendent_scrollable_overflow = if is_scroll_container { + Rect::from_top_left_and_size(border.top_left(), measured_size + padding.sum_axes()) + } else { + Rect::from_top_left_and_size(border.top_left() + padding.top_left(), measured_size) + }; LayoutOutput { size, #[cfg(feature = "content_size")] - content_size: measured_size + padding.sum_axes(), + descendent_scrollable_overflow, first_baselines: Point::NONE, top_margin: CollapsibleMarginSet::ZERO, bottom_margin: CollapsibleMarginSet::ZERO, diff --git a/src/compute/mod.rs b/src/compute/mod.rs index aeb5a5f3e..5aea27c7c 100644 --- a/src/compute/mod.rs +++ b/src/compute/mod.rs @@ -45,7 +45,7 @@ pub use self::flexbox::compute_flexbox_layout; pub use self::grid::compute_grid_layout; use crate::geometry::{Line, Point, Size}; -use crate::style::{AvailableSpace, CoreStyle, Overflow}; +use crate::style::{AvailableSpace, CoreStyle}; use crate::tree::{ Layout, LayoutInput, LayoutOutput, LayoutPartialTree, LayoutPartialTreeExt, NodeId, RoundTree, SizingMode, }; @@ -54,6 +54,9 @@ use crate::util::sys::round; use crate::util::ResolveOrZero; use crate::{CacheTree, MaybeMath, MaybeResolve}; +#[cfg(feature = "content_size")] +use crate::geometry::Rect; + /// Compute layout for the root node in the tree pub fn compute_root_layout(tree: &mut impl LayoutPartialTree, root: NodeId, available_space: Size) { let mut known_dimensions = Size::NONE; @@ -131,12 +134,17 @@ pub fn compute_root_layout(tree: &mut impl LayoutPartialTree, root: NodeId, avai style.border().resolve_or_zero(available_space.width.into_option(), |val, basis| tree.calc(val, basis)); let margin = style.margin().resolve_or_zero(available_space.width.into_option(), |val, basis| tree.calc(val, basis)); - let scrollbar_size = Size { - width: if style.overflow().y == Overflow::Scroll { style.scrollbar_width() } else { 0.0 }, - height: if style.overflow().x == Overflow::Scroll { style.scrollbar_width() } else { 0.0 }, - }; + let scrollbar_size = + common::compute_scrollbar_size(style.overflow(), output.size, padding, border, style.scrollbar_width()); drop(style); + #[cfg(feature = "content_size")] + // Now that we've picked a final size for the item, add the + // resultant padding box to the scrollable overflow. + let scrollable_overflow = output + .descendent_scrollable_overflow + .union(Rect::from_origin_and_size(output.size).inset_by(border).shrunk_by(scrollbar_size)); + tree.set_unrounded_layout( root, &Layout { @@ -144,7 +152,7 @@ pub fn compute_root_layout(tree: &mut impl LayoutPartialTree, root: NodeId, avai location: Point::ZERO, size: output.size, #[cfg(feature = "content_size")] - content_size: output.content_size, + scrollable_overflow, scrollbar_size, padding, border, @@ -187,6 +195,8 @@ where tree.cache_store(node, known_dimensions, available_space, run_mode, computed_size_and_baselines); debug_log!("RESULT", dbg:computed_size_and_baselines.size); + #[cfg(feature = "content_size")] + debug_log!(" scrollable overflow", dbg:computed_size_and_baselines.descendent_scrollable_overflow); debug_pop_node!(); computed_size_and_baselines @@ -235,7 +245,7 @@ pub fn round_layout(tree: &mut impl RoundTree, node_id: NodeId) { - round(cumulative_y + unrounded_layout.size.height - unrounded_layout.padding.bottom); #[cfg(feature = "content_size")] - round_content_size(&mut layout, unrounded_layout.content_size, cumulative_x, cumulative_y); + round_scrollable_overflow(&mut layout, unrounded_layout.scrollable_overflow, cumulative_x, cumulative_y); tree.set_final_layout(node_id, &layout); @@ -248,16 +258,21 @@ pub fn round_layout(tree: &mut impl RoundTree, node_id: NodeId) { #[cfg(feature = "content_size")] #[inline(always)] - /// Round content size variables. - /// This is split into a separate function to make it easier to feature flag. - fn round_content_size( + /// Round the scrollable overflow. This is split into a separate + /// function to make it easier to feature flag. + fn round_scrollable_overflow( layout: &mut Layout, - unrounded_content_size: Size, + unrounded_scrollable_overflow: Rect, cumulative_x: f32, cumulative_y: f32, ) { - layout.content_size.width = round(cumulative_x + unrounded_content_size.width) - round(cumulative_x); - layout.content_size.height = round(cumulative_y + unrounded_content_size.height) - round(cumulative_y); + layout.scrollable_overflow.left = + round(cumulative_x + unrounded_scrollable_overflow.left) - round(cumulative_x); + layout.scrollable_overflow.right = + round(cumulative_x + unrounded_scrollable_overflow.right) - round(cumulative_x); + layout.scrollable_overflow.top = round(cumulative_y + unrounded_scrollable_overflow.top) - round(cumulative_y); + layout.scrollable_overflow.bottom = + round(cumulative_y + unrounded_scrollable_overflow.bottom) - round(cumulative_y); } } diff --git a/src/geometry.rs b/src/geometry.rs index 8cabefcf2..9ee4b6de3 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -1,9 +1,13 @@ //! Geometric primitives useful for layout -use crate::util::sys::f32_max; -use crate::CompactLength; -use crate::{style::Dimension, util::sys::f32_min}; -use core::ops::{Add, Sub}; +use crate::{ + style::Dimension, + style_helpers::TaffyZero, + util::sys::{f32_max, f32_min}, + CompactLength, +}; + +use core::ops::{Add, Neg, Sub}; #[cfg(feature = "flexbox")] use crate::style::FlexDirection; @@ -139,7 +143,80 @@ impl> Add> for Rect { } } +impl> Sub> for Rect { + type Output = Rect; + + fn sub(self, rhs: Rect) -> Self::Output { + Rect { + left: self.left - rhs.left, + right: self.right - rhs.right, + top: self.top - rhs.top, + bottom: self.bottom - rhs.bottom, + } + } +} + +impl + Copy> Rect { + /// Create a rectangle when given the top left as a point and a + /// size. Right and bottom are the sum of the top_left and the + /// size. + pub fn from_top_left_and_size(top_left: Point, size: Size) -> Rect { + Rect { left: top_left.x, top: top_left.y, right: top_left.x + size.width, bottom: top_left.y + size.height } + } +} + +impl Rect { + /// Create a rectangle from the origin (i.e. left=0, top=0) with + /// the given size (i.e. right=width, bottom=height). + pub fn from_origin_and_size(size: Size) -> Rect { + Rect { left: T::ZERO, top: T::ZERO, right: size.width, bottom: size.height } + } +} + +impl + Copy> Rect { + /// Return the width of the rectangle (i.e. right - left). Only + /// valid if the Rect represents a rectangle area, not boundry + /// insets. + #[inline(always)] + pub fn width(&self) -> >::Output { + self.right - self.left + } + + /// Return the height of the rectangle (i.e. bottom - top). Only + /// valid if the Rect represents a rectangle area, not boundry + /// insets. + #[inline(always)] + pub fn height(self) -> >::Output { + self.bottom - self.top + } + + /// Return the width (i.e. right - left) and height (i.e. bottom - + /// top) of the rectangle as a Size. Only valid if the Rect + /// represents a rectangle area, not boundry insets. + #[inline(always)] + pub fn size(self) -> Size<>::Output> { + Size { width: self.width(), height: self.height() } + } +} + +impl Neg for Rect { + type Output = Rect<::Output>; + fn neg(self) -> Self::Output { + Rect { left: -self.left, right: -self.right, top: -self.top, bottom: -self.bottom } + } +} + impl Rect { + /// Returns the top and left components as a point. + pub fn top_left(self) -> Point { + Point { x: self.left, y: self.top } + } + + /// Returns the bottom and right components as a point. + pub fn bottom_right(self) -> Point { + Point { x: self.right, y: self.bottom } + } + /// Applies the function `f` to all four sides of the rect /// /// When applied to the left and right sides, the width is used @@ -178,6 +255,46 @@ impl Rect { pub fn vertical_components(self) -> Line { Line { start: self.top, end: self.bottom } } + + /// Return the rectangle with the edges move "in" by the + /// corresponding component of `insets`. + pub fn inset_by(self, insets: Rect) -> Rect + where + T: Add, + T: Sub, + { + Rect { + left: self.left + insets.left, + right: self.right - insets.right, + top: self.top + insets.top, + bottom: self.bottom - insets.bottom, + } + } + + /// Returns the rectangle with the horizontal components offset + /// by size.width and the vertical components offset by + /// size.height. + pub fn offset_by(self, displacement: Size) -> Rect<>::Output> + where + T: Add, + U: Copy, + { + Rect { + left: self.left + displacement.width, + right: self.right + displacement.width, + top: self.top + displacement.height, + bottom: self.bottom + displacement.height, + } + } + + /// Returns the rectangle with the bottom and right decreased by + /// the given delta. + pub fn shrunk_by(self, delta: Size) -> Rect + where + T: Sub, + { + Rect { left: self.left, right: self.right - delta.width, top: self.top, bottom: self.bottom - delta.height } + } } impl Rect @@ -296,6 +413,82 @@ impl Rect { pub const fn new(start: f32, end: f32, top: f32, bottom: f32) -> Self { Self { left: start, right: end, top, bottom } } + + /// Creates an "empty" rectangle with the left and top at positive + /// infinity and the right and bottom at negative infinity. This + /// is the identity element for union operations. + pub const fn new_empty() -> Self { + Self { left: f32::INFINITY, right: -f32::INFINITY, top: f32::INFINITY, bottom: -f32::INFINITY } + } + + /// Returns the union of self and `other`--the rectangle that + /// encloses all of the area of either rectangle. If `other` is + /// empty (i.e. right < left or bottom < top), returns self + /// unchanged. + /// + /// See also [`union_with`] + pub fn union(mut self, other: Rect) -> Rect { + self.union_with(other); + self + } + + /// Expands self to include the area of another rectangle. If + /// `other` is empty (i.e. right < left or bottom < top), leaves + /// self unchanged. + /// + pub fn union_with(&mut self, other: Rect) { + if other.left <= other.right && other.top <= other.bottom { + self.left = f32_min(self.left, other.left); + self.right = f32_max(self.right, other.right); + self.top = f32_min(self.top, other.top); + self.bottom = f32_max(self.bottom, other.bottom); + } + } + + /// Clip self against other along the X axis. Returns true iff + /// there is any overlap. Upon return, self will be within other + /// irrespective of the return value. + pub fn clip_against_x(&mut self, other: Rect) -> bool { + if self.right <= other.left { + self.left = other.left; + self.right = other.left; + false + } else if self.left >= other.right { + self.left = other.right; + self.right = other.right; + false + } else { + self.left = f32_max(self.left, other.left); + self.right = f32_min(self.right, other.right); + true + } + } + /// Clip self against other along the Y axis. Returns true iff + /// there is any overlap. Upon return, self will be within other + /// irrespective of the return value. + pub fn clip_against_y(&mut self, other: Rect) -> bool { + if self.bottom <= other.top { + self.top = other.top; + self.bottom = other.top; + false + } else if self.top >= other.bottom { + self.top = other.bottom; + self.bottom = other.bottom; + false + } else { + self.top = f32_max(self.top, other.top); + self.bottom = f32_min(self.bottom, other.bottom); + true + } + } + /// Clip self against other along the both axes. Returns true iff + /// there is any overlap. Upon return, self will be within other + /// irrespective of the return value. + pub fn clip_against(&mut self, other: Rect) -> bool { + let x = self.clip_against_x(other); + let y = self.clip_against_y(other); + x && y + } } /// An abstract "line". Represents any type that has a start and an end @@ -643,15 +836,34 @@ impl Point> { pub const NONE: Self = Self { x: None, y: None }; } -// Generic Add impl for Point + Point where T + U has an Add impl impl> Add> for Point { type Output = Point<>::Output>; + /// Generic Add impl for Point + Point where T + U has an Add impl fn add(self, rhs: Point) -> Self::Output { Point { x: self.x + rhs.x, y: self.y + rhs.y } } } +impl> Add> for Point { + type Output = Point<>::Output>; + + /// Adding a Size to a Point offsets the Point by the size. + fn add(self, rhs: Size) -> Self::Output { + Point { x: self.x + rhs.width, y: self.y + rhs.height } + } +} + +impl> Sub> for Point { + type Output = Size<>::Output>; + + /// Subtracting one point from another returns the distance between + /// them as a size. + fn sub(self, rhs: Point) -> Self::Output { + Size { width: self.x - rhs.x, height: self.y - rhs.y } + } +} + impl Point { /// Applies the function `f` to both the x and y /// @@ -687,30 +899,6 @@ impl Point { AbstractAxis::Block => self.y = value, } } - - /// Gets the component in the main layout axis - /// - /// Whether this is the x or y depends on the `direction` provided - #[cfg(feature = "flexbox")] - pub(crate) fn main(self, direction: FlexDirection) -> T { - if direction.is_row() { - self.x - } else { - self.y - } - } - - /// Gets the component in the cross layout axis - /// - /// Whether this is the x or y depends on the `direction` provided - #[cfg(feature = "flexbox")] - pub(crate) fn cross(self, direction: FlexDirection) -> T { - if direction.is_row() { - self.y - } else { - self.x - } - } } impl From> for Size { diff --git a/src/tree/layout.rs b/src/tree/layout.rs index 84a68505f..c4d92b2c0 100644 --- a/src/tree/layout.rs +++ b/src/tree/layout.rs @@ -162,8 +162,12 @@ pub struct LayoutOutput { /// The size of the node pub size: Size, #[cfg(feature = "content_size")] - /// The size of the content within the node - pub content_size: Size, + /// The scrollable overflow from child elements and leaf content + /// measures relative to the padding box. It does not include + /// this node's own padding box, because the exact dimensions of + /// this node's final size (and hence its padding box) are at the + /// whims of whoever called compute_child_layout(). + pub descendent_scrollable_overflow: Rect, /// The first baseline of the node in each dimension, if any pub first_baselines: Point>, /// Top margin that can be collapsed with. This is used for CSS block layout and can be set to @@ -182,7 +186,7 @@ impl LayoutOutput { pub const HIDDEN: Self = Self { size: Size::ZERO, #[cfg(feature = "content_size")] - content_size: Size::ZERO, + descendent_scrollable_overflow: Rect::new_empty(), first_baselines: Point::NONE, top_margin: CollapsibleMarginSet::ZERO, bottom_margin: CollapsibleMarginSet::ZERO, @@ -195,28 +199,35 @@ impl LayoutOutput { /// Constructor to create a `LayoutOutput` from just the size and baselines pub fn from_sizes_and_baselines( size: Size, - #[cfg_attr(not(feature = "content_size"), allow(unused_variables))] content_size: Size, + #[cfg(feature = "content_size")] descendent_scrollable_overflow: Rect, first_baselines: Point>, ) -> Self { Self { size, #[cfg(feature = "content_size")] - content_size, + descendent_scrollable_overflow, first_baselines, - top_margin: CollapsibleMarginSet::ZERO, - bottom_margin: CollapsibleMarginSet::ZERO, - margins_can_collapse_through: false, + ..Self::DEFAULT } } - /// Construct a `LayoutOutput` from just the container and content sizes - pub fn from_sizes(size: Size, content_size: Size) -> Self { - Self::from_sizes_and_baselines(size, content_size, Point::NONE) + /// Construct a `LayoutOutput` from just the container size and + /// scrollable overflow. + pub fn from_size_and_overflow( + size: Size, + #[cfg(feature = "content_size")] descendent_scrollable_overflow: Rect, + ) -> Self { + Self { + size, + #[cfg(feature = "content_size")] + descendent_scrollable_overflow, + ..Self::DEFAULT + } } /// Construct a `LayoutOutput` from just the container's size. pub fn from_outer_size(size: Size) -> Self { - Self::from_sizes(size, Size::zero()) + Self { size, ..Self::DEFAULT } } } @@ -234,9 +245,11 @@ pub struct Layout { /// The width and height of the node pub size: Size, #[cfg(feature = "content_size")] - /// The width and height of the content inside the node. This may be larger than the size of the node in the case of - /// overflowing content and is useful for computing a "scroll width/height" for scrollable nodes - pub content_size: Size, + /// The extent of the scrollable overflow from this node and any + /// (unclipped) descendents. This will always include this nodes + /// padding box and additionally includes the overflow from any + /// children that are not themselves clipped. + pub scrollable_overflow: Rect, /// The size of the scrollbars in each dimension. If there is no scrollbar then the size will be zero. pub scrollbar_size: Size, /// The size of the borders of the node @@ -266,7 +279,7 @@ impl Layout { location: Point::ZERO, size: Size::zero(), #[cfg(feature = "content_size")] - content_size: Size::zero(), + scrollable_overflow: Rect::zero(), scrollbar_size: Size::zero(), border: Rect::zero(), padding: Rect::zero(), @@ -285,7 +298,7 @@ impl Layout { size: Size::zero(), location: Point::ZERO, #[cfg(feature = "content_size")] - content_size: Size::zero(), + scrollable_overflow: Rect::zero(), scrollbar_size: Size::zero(), border: Rect::zero(), padding: Rect::zero(), @@ -324,24 +337,34 @@ impl Layout { #[cfg(feature = "content_size")] impl Layout { - /// Return the scroll width of the node. - /// The scroll width is the difference between the width and the content width, floored at zero + /// Return the scroll width of the node. The scroll width is the + /// difference between the padding box width and the portion of + /// the scrollable overflow to the right of the scroll origin. + /// The scroll origin is currently always the padding box's + /// top-left corner but there are unimplemented parts of the CSS + /// standard that cause it to move. pub fn scroll_width(&self) -> f32 { - f32_max( - 0.0, - self.content_size.width + f32_min(self.scrollbar_size.width, self.size.width) - self.size.width - + self.border.right, - ) + let right_padding_edge = + f32_max(self.size.width - self.border.right - self.scrollbar_size.width, self.border.left); + // The scrollable overflow always include the node's padding + // box, so this can never result in a negative value. + assert!(self.scrollable_overflow.right >= right_padding_edge); + return self.scrollable_overflow.right - right_padding_edge; } - /// Return the scroll height of the node. - /// The scroll height is the difference between the height and the content height, floored at zero + /// Return the scroll height of the node. The scroll height is + /// the difference between the padding box height and the portion + /// of the scrollable overflow below the top padding edge. The + /// scroll origin is currently always the padding box's top-left + /// corner but there are unimplemented parts of the CSS standard + /// that cause it to move. pub fn scroll_height(&self) -> f32 { - f32_max( - 0.0, - self.content_size.height + f32_min(self.scrollbar_size.height, self.size.height) - self.size.height - + self.border.bottom, - ) + let bottom_padding_edge = + f32_max(self.size.height - self.border.bottom - self.scrollbar_size.height, self.border.top); + // The scrollable overflow always include the node's padding + // box, so this can never result in a negative value. + assert!(self.scrollable_overflow.bottom >= bottom_padding_edge); + return self.scrollable_overflow.bottom - bottom_padding_edge; } } diff --git a/src/util/print.rs b/src/util/print.rs index 4d2fa3961..5e95985d3 100644 --- a/src/util/print.rs +++ b/src/util/print.rs @@ -15,26 +15,32 @@ pub fn print_tree(tree: &impl PrintTree, root: NodeId) { let fork_string = if has_sibling { "├── " } else { "└── " }; #[cfg(feature = "content_size")] println!( - "{lines}{fork} {display} [x: {x:<4} y: {y:<4} w: {width:<4} h: {height:<4} content_w: {content_width:<4} content_h: {content_height:<4} border: l:{bl} r:{br} t:{bt} b:{bb}, padding: l:{pl} r:{pr} t:{pt} b:{pb}] ({key:?})", - lines = lines_string, - fork = fork_string, - display = display, - x = layout.location.x, - y = layout.location.y, - width = layout.size.width, - height = layout.size.height, - content_width = layout.content_size.width, - content_height = layout.content_size.height, - bl = layout.border.left, - br = layout.border.right, - bt = layout.border.top, - bb = layout.border.bottom, - pl = layout.padding.left, - pr = layout.padding.right, - pt = layout.padding.top, - pb = layout.padding.bottom, - key = node_id, - ); + "{lines}{fork} {display} [x: {x:<4} y: {y:<4} w: {width:<4} h: {height:<4} scroll_w: {scroll_width:<4} scroll_h: {scroll_height:<4} border: l:{bl} r:{br} t:{bt} b:{bb}, padding: l:{pl} r:{pr} t:{pt} b:{pb} scrollbar: w:{sbw} h:{sbh} scrollable_overflow: x:{sol}..{sor} y: {sot}..{sob}] ({key:?})", + lines = lines_string, + fork = fork_string, + display = display, + x = layout.location.x, + y = layout.location.y, + width = layout.size.width, + height = layout.size.height, + scroll_width = layout.scroll_width(), + scroll_height = layout.scroll_height(), + bl = layout.border.left, + br = layout.border.right, + bt = layout.border.top, + bb = layout.border.bottom, + pl = layout.padding.left, + pr = layout.padding.right, + pt = layout.padding.top, + pb = layout.padding.bottom, + sbw = layout.scrollbar_size.width, + sbh = layout.scrollbar_size.height, + sol = layout.scrollable_overflow.left, + sor = layout.scrollable_overflow.right, + sot = layout.scrollable_overflow.top, + sob = layout.scrollable_overflow.bottom, + key = node_id, + ); #[cfg(not(feature = "content_size"))] println!( "{lines}{fork} {display} [x: {x:<4} y: {y:<4} width: {width:<4} height: {height:<4}] ({key:?})", diff --git a/test_fixtures/block/block_absolute_overflow_clip.html b/test_fixtures/block/block_absolute_overflow_clip.html new file mode 100644 index 000000000..8f6118ace --- /dev/null +++ b/test_fixtures/block/block_absolute_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_absolute_overflow_hidden.html b/test_fixtures/block/block_absolute_overflow_hidden.html new file mode 100644 index 000000000..3b16f3ca3 --- /dev/null +++ b/test_fixtures/block/block_absolute_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_absolute_overflow_scroll.html b/test_fixtures/block/block_absolute_overflow_scroll.html new file mode 100644 index 000000000..6b0749c4e --- /dev/null +++ b/test_fixtures/block/block_absolute_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_absolute_overflow_visible.html b/test_fixtures/block/block_absolute_overflow_visible.html new file mode 100644 index 000000000..504723e16 --- /dev/null +++ b/test_fixtures/block/block_absolute_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_inflow_overflow_clip.html b/test_fixtures/block/block_inflow_overflow_clip.html new file mode 100644 index 000000000..48430c63e --- /dev/null +++ b/test_fixtures/block/block_inflow_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_inflow_overflow_hidden.html b/test_fixtures/block/block_inflow_overflow_hidden.html new file mode 100644 index 000000000..3bc38d0c6 --- /dev/null +++ b/test_fixtures/block/block_inflow_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_inflow_overflow_scroll.html b/test_fixtures/block/block_inflow_overflow_scroll.html new file mode 100644 index 000000000..3ff35571a --- /dev/null +++ b/test_fixtures/block/block_inflow_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/block/block_inflow_overflow_visible.html b/test_fixtures/block/block_inflow_overflow_visible.html new file mode 100644 index 000000000..6cfc22d80 --- /dev/null +++ b/test_fixtures/block/block_inflow_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/content_size_with_border.html b/test_fixtures/flex/content_size_with_border.html new file mode 100644 index 000000000..facb374fe --- /dev/null +++ b/test_fixtures/flex/content_size_with_border.html @@ -0,0 +1,36 @@ + + + + + + + Test description + + + + +
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
XXXXXXXXXXXXXXXXXXXX
+
+ + + diff --git a/test_fixtures/flex/flex_absolute_overflow_clip.html b/test_fixtures/flex/flex_absolute_overflow_clip.html new file mode 100644 index 000000000..0f5873bfd --- /dev/null +++ b/test_fixtures/flex/flex_absolute_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_absolute_overflow_hidden.html b/test_fixtures/flex/flex_absolute_overflow_hidden.html new file mode 100644 index 000000000..0b2bf812c --- /dev/null +++ b/test_fixtures/flex/flex_absolute_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_absolute_overflow_scroll.html b/test_fixtures/flex/flex_absolute_overflow_scroll.html new file mode 100644 index 000000000..1f86b5f48 --- /dev/null +++ b/test_fixtures/flex/flex_absolute_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_absolute_overflow_visible.html b/test_fixtures/flex/flex_absolute_overflow_visible.html new file mode 100644 index 000000000..8540a85ae --- /dev/null +++ b/test_fixtures/flex/flex_absolute_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_inflow_overflow_clip.html b/test_fixtures/flex/flex_inflow_overflow_clip.html new file mode 100644 index 000000000..b9956cc1f --- /dev/null +++ b/test_fixtures/flex/flex_inflow_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_inflow_overflow_hidden.html b/test_fixtures/flex/flex_inflow_overflow_hidden.html new file mode 100644 index 000000000..bf73bd8f7 --- /dev/null +++ b/test_fixtures/flex/flex_inflow_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_inflow_overflow_scroll.html b/test_fixtures/flex/flex_inflow_overflow_scroll.html new file mode 100644 index 000000000..1a3357266 --- /dev/null +++ b/test_fixtures/flex/flex_inflow_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/flex/flex_inflow_overflow_visible.html b/test_fixtures/flex/flex_inflow_overflow_visible.html new file mode 100644 index 000000000..cf439a19d --- /dev/null +++ b/test_fixtures/flex/flex_inflow_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_absolute_overflow_clip.html b/test_fixtures/grid/grid_absolute_overflow_clip.html new file mode 100644 index 000000000..a9146984b --- /dev/null +++ b/test_fixtures/grid/grid_absolute_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_absolute_overflow_hidden.html b/test_fixtures/grid/grid_absolute_overflow_hidden.html new file mode 100644 index 000000000..e89a84975 --- /dev/null +++ b/test_fixtures/grid/grid_absolute_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_absolute_overflow_scroll.html b/test_fixtures/grid/grid_absolute_overflow_scroll.html new file mode 100644 index 000000000..a0e86a8f5 --- /dev/null +++ b/test_fixtures/grid/grid_absolute_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_absolute_overflow_visible.html b/test_fixtures/grid/grid_absolute_overflow_visible.html new file mode 100644 index 000000000..ed14fe283 --- /dev/null +++ b/test_fixtures/grid/grid_absolute_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_inflow_overflow_clip.html b/test_fixtures/grid/grid_inflow_overflow_clip.html new file mode 100644 index 000000000..6964d3b10 --- /dev/null +++ b/test_fixtures/grid/grid_inflow_overflow_clip.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_inflow_overflow_hidden.html b/test_fixtures/grid/grid_inflow_overflow_hidden.html new file mode 100644 index 000000000..dadf56e27 --- /dev/null +++ b/test_fixtures/grid/grid_inflow_overflow_hidden.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_inflow_overflow_scroll.html b/test_fixtures/grid/grid_inflow_overflow_scroll.html new file mode 100644 index 000000000..7f9a50f63 --- /dev/null +++ b/test_fixtures/grid/grid_inflow_overflow_scroll.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/grid/grid_inflow_overflow_visible.html b/test_fixtures/grid/grid_inflow_overflow_visible.html new file mode 100644 index 000000000..a05eb64ce --- /dev/null +++ b/test_fixtures/grid/grid_inflow_overflow_visible.html @@ -0,0 +1,18 @@ + + + + + + + Test description + + + + +
+
+
+
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_clip.html b/test_fixtures/leaf/leaf_overflow_clip.html new file mode 100644 index 000000000..af49931d0 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_clip.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_clip_with_border.html b/test_fixtures/leaf/leaf_overflow_clip_with_border.html new file mode 100644 index 000000000..6fff879e5 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_clip_with_border.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_clip_with_border_and_padding.html b/test_fixtures/leaf/leaf_overflow_clip_with_border_and_padding.html new file mode 100644 index 000000000..910a67162 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_clip_with_border_and_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_clip_with_padding.html b/test_fixtures/leaf/leaf_overflow_clip_with_padding.html new file mode 100644 index 000000000..444cbe1a7 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_clip_with_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_hidden.html b/test_fixtures/leaf/leaf_overflow_hidden.html new file mode 100644 index 000000000..5d5ae342d --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_hidden.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_hidden_with_border.html b/test_fixtures/leaf/leaf_overflow_hidden_with_border.html new file mode 100644 index 000000000..e228968f6 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_hidden_with_border.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_hidden_with_border_and_padding.html b/test_fixtures/leaf/leaf_overflow_hidden_with_border_and_padding.html new file mode 100644 index 000000000..ec4be8c3b --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_hidden_with_border_and_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_hidden_with_padding.html b/test_fixtures/leaf/leaf_overflow_hidden_with_padding.html new file mode 100644 index 000000000..7bb26437a --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_hidden_with_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_scroll.html b/test_fixtures/leaf/leaf_overflow_scroll.html new file mode 100644 index 000000000..8af1a3449 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_scroll.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_scroll_with_border.html b/test_fixtures/leaf/leaf_overflow_scroll_with_border.html new file mode 100644 index 000000000..149e441b9 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_scroll_with_border.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_scroll_with_border_and_padding.html b/test_fixtures/leaf/leaf_overflow_scroll_with_border_and_padding.html new file mode 100644 index 000000000..d205bfbdf --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_scroll_with_border_and_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_scroll_with_padding.html b/test_fixtures/leaf/leaf_overflow_scroll_with_padding.html new file mode 100644 index 000000000..c8c77a9e2 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_scroll_with_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_visible.html b/test_fixtures/leaf/leaf_overflow_visible.html new file mode 100644 index 000000000..0fb8b0cfa --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_visible.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_visible_with_border.html b/test_fixtures/leaf/leaf_overflow_visible_with_border.html new file mode 100644 index 000000000..ff01c06e2 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_visible_with_border.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_visible_with_border_and_padding.html b/test_fixtures/leaf/leaf_overflow_visible_with_border_and_padding.html new file mode 100644 index 000000000..f83198c5a --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_visible_with_border_and_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + diff --git a/test_fixtures/leaf/leaf_overflow_visible_with_padding.html b/test_fixtures/leaf/leaf_overflow_visible_with_padding.html new file mode 100644 index 000000000..fac4176b0 --- /dev/null +++ b/test_fixtures/leaf/leaf_overflow_visible_with_padding.html @@ -0,0 +1,17 @@ + + + + + + + Test description + + + + +
+ HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH​HHHHHHHHHHHHHHHHHHHHH +
+ + + 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 4144b4bc2..4176d8e26 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 @@ -34,18 +34,92 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__bord println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__cont println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b8d123706..6fd0bd56f 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs @@ -35,18 +35,86 @@ fn block_absolute_aspect_ratio_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn block_absolute_aspect_ratio_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6e24b53ad..0a3bfe265 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 @@ -34,18 +34,92 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8c615578c..e7636c27b 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 @@ -4,6 +4,8 @@ fn block_absolute_aspect_ratio_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -12,10 +14,7 @@ fn block_absolute_aspect_ratio_fill_max_height__border_box() { aspect_ratio: Some(3f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -35,18 +34,86 @@ fn block_absolute_aspect_ratio_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 73f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 73f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,6 +122,8 @@ fn block_absolute_aspect_ratio_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -64,10 +133,7 @@ fn block_absolute_aspect_ratio_fill_max_height__content_box() { aspect_ratio: Some(3f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -88,16 +154,84 @@ fn block_absolute_aspect_ratio_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 73f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 73f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 99a803fe5..ab058bfd3 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 @@ -4,6 +4,8 @@ fn block_absolute_aspect_ratio_fill_max_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -12,10 +14,7 @@ fn block_absolute_aspect_ratio_fill_max_width__border_box() { aspect_ratio: Some(0.5f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -35,18 +34,86 @@ fn block_absolute_aspect_ratio_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,6 +122,8 @@ fn block_absolute_aspect_ratio_fill_max_width__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -64,10 +133,7 @@ fn block_absolute_aspect_ratio_fill_max_width__content_box() { aspect_ratio: Some(0.5f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -88,16 +154,84 @@ fn block_absolute_aspect_ratio_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4ef216a5c..a78976455 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 @@ -29,18 +29,86 @@ fn block_absolute_aspect_ratio_fill_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_absolute_aspect_ratio_fill_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d4b0e0d5f..e0144e5ed 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 @@ -29,18 +29,86 @@ fn block_absolute_aspect_ratio_fill_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_absolute_aspect_ratio_fill_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 697c6fc3e..733fb6941 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs @@ -35,18 +35,86 @@ fn block_absolute_aspect_ratio_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn block_absolute_aspect_ratio_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 493ac0754..224aa8073 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 @@ -29,18 +29,86 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dc36bf32e..f6073599a 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 @@ -30,18 +30,86 @@ fn block_absolute_aspect_ratio_height_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn block_absolute_aspect_ratio_height_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 028749dd3..ef51498e9 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 @@ -35,18 +35,86 @@ fn block_absolute_aspect_ratio_width_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn block_absolute_aspect_ratio_width_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b9619a1c5..97ae0ad10 100644 --- a/tests/generated/block/block_absolute_child_with_margin_x.rs +++ b/tests/generated/block/block_absolute_child_with_margin_x.rs @@ -54,30 +54,164 @@ fn block_absolute_child_with_margin_x__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 7f32, "x of node {:?}. Expected {}. Actual {}", node0, 7f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node1, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node1, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node2, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node2, 9f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,28 +274,162 @@ fn block_absolute_child_with_margin_x__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 7f32, "x of node {:?}. Expected {}. Actual {}", node0, 7f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node1, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node1, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node2, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node2, 9f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 88509116c..4894caa35 100644 --- a/tests/generated/block/block_absolute_child_with_margin_y.rs +++ b/tests/generated/block/block_absolute_child_with_margin_y.rs @@ -54,30 +54,164 @@ fn block_absolute_child_with_margin_y__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node0, 7f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node1, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node1, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node2, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node2, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,28 +274,162 @@ fn block_absolute_child_with_margin_y__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node0, 7f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node1, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node1, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node2, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node2, 9f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0b8ce9a1e..a3323ce96 100644 --- a/tests/generated/block/block_absolute_child_with_max_height.rs +++ b/tests/generated/block/block_absolute_child_with_max_height.rs @@ -43,24 +43,137 @@ fn block_absolute_child_with_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 30f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node00, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -111,22 +224,135 @@ fn block_absolute_child_with_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 30f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node00, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_layout_child_order.rs b/tests/generated/block/block_absolute_layout_child_order.rs index 52bf4d69b..173fae8e0 100644 --- a/tests/generated/block/block_absolute_layout_child_order.rs +++ b/tests/generated/block/block_absolute_layout_child_order.rs @@ -54,30 +54,164 @@ fn block_absolute_layout_child_order__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,28 +274,162 @@ fn block_absolute_layout_child_order__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_layout_no_size.rs b/tests/generated/block/block_absolute_layout_no_size.rs index de83fe11d..ee1acbace 100644 --- a/tests/generated/block/block_absolute_layout_no_size.rs +++ b/tests/generated/block/block_absolute_layout_no_size.rs @@ -24,18 +24,86 @@ fn block_absolute_layout_no_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn block_absolute_layout_no_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4327e2c05..76f122928 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 @@ -54,30 +54,170 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node2, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,28 +280,168 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__content_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node2, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_layout_percentage_height.rs b/tests/generated/block/block_absolute_layout_percentage_height.rs index 344041033..c2a22e5b1 100644 --- a/tests/generated/block/block_absolute_layout_percentage_height.rs +++ b/tests/generated/block/block_absolute_layout_percentage_height.rs @@ -32,18 +32,86 @@ fn block_absolute_layout_percentage_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn block_absolute_layout_percentage_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 82162395a..eb87a979b 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 @@ -32,18 +32,86 @@ fn block_absolute_layout_row_width_height_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn block_absolute_layout_row_width_height_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c106af61d..a9c952e1d 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 @@ -34,18 +34,86 @@ fn block_absolute_layout_start_top_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +154,84 @@ fn block_absolute_layout_start_top_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0609cefb2..d4c70b688 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 @@ -33,18 +33,86 @@ fn block_absolute_layout_width_height_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn block_absolute_layout_width_height_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 692ae20af..89dcc6481 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 @@ -33,18 +33,86 @@ fn block_absolute_layout_width_height_start_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn block_absolute_layout_width_height_start_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6ac862338..5a929401d 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 @@ -38,18 +38,86 @@ fn block_absolute_layout_width_height_start_top_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_layout_width_height_start_top_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_layout_within_border.rs b/tests/generated/block/block_absolute_layout_within_border.rs index 070216685..69b578b6e 100644 --- a/tests/generated/block/block_absolute_layout_within_border.rs +++ b/tests/generated/block/block_absolute_layout_within_border.rs @@ -93,36 +93,203 @@ fn block_absolute_layout_within_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -225,34 +392,201 @@ fn block_absolute_layout_within_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node3, 70f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d1230cbf9..6e5f23b3a 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a6cefdd9a..2c4b44674 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d8d223a9c..5a0747a9d 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 @@ -39,18 +39,86 @@ fn block_absolute_margin_auto_bottom_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,16 +164,84 @@ fn block_absolute_margin_auto_bottom_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d79391b06..1c2bde275 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_bottom_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_bottom_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 84aa8a734..e89774d7a 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_left_and_right_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_left_and_right_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 210affa03..e0bd95bcb 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_left_and_right_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_left_and_right_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bcc34af4a..73fbb16d4 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__border_b println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, -40f32, "x of node {:?}. Expected {}. Actual {}", node0, -40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__content_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, -40f32, "x of node {:?}. Expected {}. Actual {}", node0, -40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4b3c98090..5f00b80d3 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__borde println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__conte println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7759ef4e0..07b4ef255 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, -50f32, "x of node {:?}. Expected {}. Actual {}", node0, -50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, -50f32, "x of node {:?}. Expected {}. Actual {}", node0, -50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 175ceb08d..3db50fc8b 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 83c1c7eb2..bde4df2e4 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__bo println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 30f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__co println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 30f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a6592fd0b..bc079f66f 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 28fd469ae..c02e4c605 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_left_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node0, 130f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_left_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node0, 130f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f0a6d304e..569cb85db 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 @@ -37,18 +37,86 @@ fn block_absolute_margin_auto_left_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_margin_auto_left_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs index 6db20c4c3..a95c41836 100644 --- a/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs @@ -56,24 +56,125 @@ fn block_absolute_margin_auto_multiple_children_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -137,22 +238,123 @@ fn block_absolute_margin_auto_multiple_children_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs index a5357fe86..c59916781 100644 --- a/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs @@ -54,24 +54,125 @@ fn block_absolute_margin_auto_multiple_children_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -133,22 +234,123 @@ fn block_absolute_margin_auto_multiple_children_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9308f23dd..32b3a65de 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 @@ -39,18 +39,86 @@ fn block_absolute_margin_auto_right_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,16 +164,84 @@ fn block_absolute_margin_auto_right_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 32ffd4812..4c7bd2771 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_right_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_right_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c48285d2a..a92e402be 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 @@ -39,18 +39,86 @@ fn block_absolute_margin_auto_top_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node0, 140f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,16 +164,84 @@ fn block_absolute_margin_auto_top_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node0, 140f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 712c56a69..bea17f9dd 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 @@ -38,18 +38,86 @@ fn block_absolute_margin_auto_top_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_margin_auto_top_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6444efa4a..db85a19f7 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 @@ -39,18 +39,86 @@ fn block_absolute_margin_bottom_left_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,16 +164,84 @@ fn block_absolute_margin_bottom_left_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cc40a4e19..cb72b2b0d 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 @@ -33,18 +33,86 @@ fn block_absolute_margin_bottom_left_without_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn block_absolute_margin_bottom_left_without_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 99dab5704..0ccf4a80b 100644 --- a/tests/generated/block/block_absolute_minmax_bottom_right_max.rs +++ b/tests/generated/block/block_absolute_minmax_bottom_right_max.rs @@ -37,18 +37,86 @@ fn block_absolute_minmax_bottom_right_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_minmax_bottom_right_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 df8830ae4..4bdbc85d2 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 @@ -37,18 +37,86 @@ fn block_absolute_minmax_bottom_right_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn block_absolute_minmax_bottom_right_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1ccef69e4..44e36e133 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 @@ -41,18 +41,86 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,16 +168,84 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1bb770baa..31587651b 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 @@ -38,18 +38,86 @@ fn block_absolute_minmax_top_left_bottom_right_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn block_absolute_minmax_top_left_bottom_right_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bf2653706..aa0fcc024 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 @@ -42,18 +42,86 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -102,16 +170,84 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_no_styles.rs b/tests/generated/block/block_absolute_no_styles.rs index da0e708c0..a4b506a62 100644 --- a/tests/generated/block/block_absolute_no_styles.rs +++ b/tests/generated/block/block_absolute_no_styles.rs @@ -31,24 +31,125 @@ fn block_absolute_no_styles__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,22 +191,123 @@ fn block_absolute_no_styles__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_overflow_clip.rs b/tests/generated/block/block_absolute_overflow_clip.rs new file mode 100644 index 000000000..a918b3709 --- /dev/null +++ b/tests/generated/block/block_absolute_overflow_clip.rs @@ -0,0 +1,289 @@ +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_absolute_overflow_hidden.rs b/tests/generated/block/block_absolute_overflow_hidden.rs new file mode 100644 index 000000000..f91bfd320 --- /dev/null +++ b/tests/generated/block/block_absolute_overflow_hidden.rs @@ -0,0 +1,295 @@ +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_absolute_overflow_scroll.rs b/tests/generated/block/block_absolute_overflow_scroll.rs new file mode 100644 index 000000000..c4e02eea8 --- /dev/null +++ b/tests/generated/block/block_absolute_overflow_scroll.rs @@ -0,0 +1,295 @@ +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 66f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 66f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 43f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 43f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 52f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 52f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_absolute_overflow_visible.rs b/tests/generated/block/block_absolute_overflow_visible.rs new file mode 100644 index 000000000..e95cad842 --- /dev/null +++ b/tests/generated/block/block_absolute_overflow_visible.rs @@ -0,0 +1,285 @@ +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_absolute_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} 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 60394dbcd..27931f3c4 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 @@ -37,18 +37,86 @@ fn block_absolute_padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,16 +163,84 @@ fn block_absolute_padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 01ecc6e73..115f2ee46 100644 --- a/tests/generated/block/block_absolute_padding_border_overrides_size.rs +++ b/tests/generated/block/block_absolute_padding_border_overrides_size.rs @@ -37,18 +37,86 @@ fn block_absolute_padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,16 +163,84 @@ fn block_absolute_padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 34f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 34f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 26f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_absolute_resolved_insets.rs b/tests/generated/block/block_absolute_resolved_insets.rs index 82bf48514..287e4c3f3 100644 --- a/tests/generated/block/block_absolute_resolved_insets.rs +++ b/tests/generated/block/block_absolute_resolved_insets.rs @@ -213,132 +213,746 @@ fn block_absolute_resolved_insets__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node, 600f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 165f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node2, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node2, 200f32, size.height); - assert_eq!(location.x, 400f32, "x of node {:?}. Expected {}. Actual {}", node2, 400f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 400f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node20, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node20, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node21, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node21, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node21, 35f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node21, 45f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -578,130 +1192,744 @@ fn block_absolute_resolved_insets__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 810f32, "width of node {:?}. Expected {}. Actual {}", node, 810f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 810f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 810f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 270f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node0, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node0, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node02, 250f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node02, 250f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 230f32, "width of node {:?}. Expected {}. Actual {}", node05, 230f32, size.width); - assert_eq!(size.height, 230f32, "height of node {:?}. Expected {}. Actual {}", node05, 230f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 230f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 230f32, layout.size.width); + } + if layout.size.height != 230f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 230f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node1, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node1, 270f32, size.height); - assert_eq!(location.x, 270f32, "x of node {:?}. Expected {}. Actual {}", node1, 270f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 270f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 235f32, "x of node {:?}. Expected {}. Actual {}", node12, 235f32, location.x); - assert_eq!(location.y, 235f32, "y of node {:?}. Expected {}. Actual {}", node12, 235f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 235f32, layout.location.x); + } + if layout.location.y != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 235f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 215f32, "width of node {:?}. Expected {}. Actual {}", node15, 215f32, size.width); - assert_eq!(size.height, 215f32, "height of node {:?}. Expected {}. Actual {}", node15, 215f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 215f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 215f32, layout.size.width); + } + if layout.size.height != 215f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 215f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node2, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node2, 270f32, size.height); - assert_eq!(location.x, 540f32, "x of node {:?}. Expected {}. Actual {}", node2, 540f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 540f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 540f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node20, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node20, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node21, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node21, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node21, 35f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node21, 45f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_align_baseline_child.rs b/tests/generated/block/block_align_baseline_child.rs index 1e593e786..e151689bc 100644 --- a/tests/generated/block/block_align_baseline_child.rs +++ b/tests/generated/block/block_align_baseline_child.rs @@ -53,30 +53,170 @@ fn block_align_baseline_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -138,28 +278,168 @@ fn block_align_baseline_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_align_baseline_child_margin.rs b/tests/generated/block/block_align_baseline_child_margin.rs index c3af16fb6..8bfb606f9 100644 --- a/tests/generated/block/block_align_baseline_child_margin.rs +++ b/tests/generated/block/block_align_baseline_child_margin.rs @@ -65,30 +65,170 @@ fn block_align_baseline_child_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,28 +302,168 @@ fn block_align_baseline_child_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e10373411..8bb8efdb6 100644 --- a/tests/generated/block/block_align_baseline_child_margin_percent.rs +++ b/tests/generated/block/block_align_baseline_child_margin_percent.rs @@ -66,30 +66,170 @@ fn block_align_baseline_child_margin_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,28 +304,168 @@ fn block_align_baseline_child_margin_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_align_baseline_child_padding.rs b/tests/generated/block/block_align_baseline_child_padding.rs index 848916cca..e89a14232 100644 --- a/tests/generated/block/block_align_baseline_child_padding.rs +++ b/tests/generated/block/block_align_baseline_child_padding.rs @@ -66,30 +66,170 @@ fn block_align_baseline_child_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,28 +304,168 @@ fn block_align_baseline_child_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 110f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node1, 25f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_align_baseline_child_top.rs b/tests/generated/block/block_align_baseline_child_top.rs index 042ea3541..7edcd7c77 100644 --- a/tests/generated/block/block_align_baseline_child_top.rs +++ b/tests/generated/block/block_align_baseline_child_top.rs @@ -55,30 +55,170 @@ fn block_align_baseline_child_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -142,28 +282,168 @@ fn block_align_baseline_child_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_align_baseline_child_top2.rs b/tests/generated/block/block_align_baseline_child_top2.rs index a56d8f853..65a5f9f8c 100644 --- a/tests/generated/block/block_align_baseline_child_top2.rs +++ b/tests/generated/block/block_align_baseline_child_top2.rs @@ -55,30 +55,170 @@ fn block_align_baseline_child_top2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -142,28 +282,168 @@ fn block_align_baseline_child_top2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 83f38648e..cc78903fa 100644 --- a/tests/generated/block/block_align_baseline_double_nested_child.rs +++ b/tests/generated/block/block_align_baseline_double_nested_child.rs @@ -67,36 +67,215 @@ fn block_align_baseline_double_nested_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,34 +352,213 @@ fn block_align_baseline_double_nested_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_aspect_ratio_fill_height.rs b/tests/generated/block/block_aspect_ratio_fill_height.rs index b42b4359b..e76fabf0d 100644 --- a/tests/generated/block/block_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_height.rs @@ -29,18 +29,86 @@ fn block_aspect_ratio_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_aspect_ratio_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 26624f97a..cc0d01d29 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_height.rs @@ -4,7 +4,19 @@ fn block_aspect_ratio_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { display : taffy :: style :: Display :: Block , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -22,18 +34,86 @@ fn block_aspect_ratio_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -42,7 +122,20 @@ fn block_aspect_ratio_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { display : taffy :: style :: Display :: Block , box_sizing : taffy :: style :: BoxSizing :: ContentBox , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -61,16 +154,84 @@ fn block_aspect_ratio_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4fa31aeb8..cd83028e0 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_width.rs @@ -32,18 +32,86 @@ fn block_aspect_ratio_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn block_aspect_ratio_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c7180317f..a3924ffee 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_height.rs @@ -29,18 +29,86 @@ fn block_aspect_ratio_fill_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_aspect_ratio_fill_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 763ad72ff..99c7943d4 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_width.rs @@ -32,18 +32,86 @@ fn block_aspect_ratio_fill_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn block_aspect_ratio_fill_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_aspect_ratio_fill_width.rs b/tests/generated/block/block_aspect_ratio_fill_width.rs index e6c3b6823..20ca9367a 100644 --- a/tests/generated/block/block_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_width.rs @@ -29,18 +29,86 @@ fn block_aspect_ratio_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_aspect_ratio_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_basic.rs b/tests/generated/block/block_basic.rs index 4cde7c64c..7cb4455f8 100644 --- a/tests/generated/block/block_basic.rs +++ b/tests/generated/block/block_basic.rs @@ -30,24 +30,125 @@ fn block_basic__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -85,22 +186,123 @@ fn block_basic__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_border_fixed_size.rs b/tests/generated/block/block_border_fixed_size.rs index bfd644606..4fdc761a7 100644 --- a/tests/generated/block/block_border_fixed_size.rs +++ b/tests/generated/block/block_border_fixed_size.rs @@ -39,24 +39,125 @@ fn block_border_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 38f32, "width of node {:?}. Expected {}. Actual {}", node0, 38f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 38f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 38f32, "width of node {:?}. Expected {}. Actual {}", node1, 38f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 38f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_border_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 58f32, "height of node {:?}. Expected {}. Actual {}", node, 58f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 58f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 58f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_border_intrinsic_size.rs b/tests/generated/block/block_border_intrinsic_size.rs index 5653f51ad..c50ee3fbc 100644 --- a/tests/generated/block/block_border_intrinsic_size.rs +++ b/tests/generated/block/block_border_intrinsic_size.rs @@ -38,24 +38,125 @@ fn block_border_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 28f32, "height of node {:?}. Expected {}. Actual {}", node, 28f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 28f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn block_border_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 28f32, "height of node {:?}. Expected {}. Actual {}", node, 28f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 28f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_border_percentage_fixed_size.rs b/tests/generated/block/block_border_percentage_fixed_size.rs index a2f4809f9..1e4740dab 100644 --- a/tests/generated/block/block_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_border_percentage_fixed_size.rs @@ -34,24 +34,131 @@ fn block_border_percentage_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,22 +203,129 @@ fn block_border_percentage_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_border_percentage_intrinsic_size.rs b/tests/generated/block/block_border_percentage_intrinsic_size.rs index 33a6b4481..9825c04cf 100644 --- a/tests/generated/block/block_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_border_percentage_intrinsic_size.rs @@ -27,24 +27,131 @@ fn block_border_percentage_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -85,22 +192,129 @@ fn block_border_percentage_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_display_none.rs b/tests/generated/block/block_display_none.rs index e45bc142d..58454958c 100644 --- a/tests/generated/block/block_display_none.rs +++ b/tests/generated/block/block_display_none.rs @@ -37,30 +37,164 @@ fn block_display_none__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -106,28 +240,162 @@ fn block_display_none__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_display_none_with_child.rs b/tests/generated/block/block_display_none_with_child.rs index d19a40228..b5fc73427 100644 --- a/tests/generated/block/block_display_none_with_child.rs +++ b/tests/generated/block/block_display_none_with_child.rs @@ -48,36 +48,203 @@ fn block_display_none_with_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -138,34 +305,201 @@ fn block_display_none_with_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_display_none_with_inset.rs b/tests/generated/block/block_display_none_with_inset.rs index 9daeb9a81..4b7bfda2e 100644 --- a/tests/generated/block/block_display_none_with_inset.rs +++ b/tests/generated/block/block_display_none_with_inset.rs @@ -35,24 +35,125 @@ fn block_display_none_with_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,22 +196,123 @@ fn block_display_none_with_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_display_none_with_margin.rs b/tests/generated/block/block_display_none_with_margin.rs index 2b70ce565..e43b15ca9 100644 --- a/tests/generated/block/block_display_none_with_margin.rs +++ b/tests/generated/block/block_display_none_with_margin.rs @@ -43,24 +43,125 @@ fn block_display_none_with_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -111,22 +212,123 @@ fn block_display_none_with_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f145807f2..85dcb3ddc 100644 --- a/tests/generated/block/block_display_none_with_position_absolute.rs +++ b/tests/generated/block/block_display_none_with_position_absolute.rs @@ -32,18 +32,86 @@ fn block_display_none_with_position_absolute__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn block_display_none_with_position_absolute__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_inflow_overflow_clip.rs b/tests/generated/block/block_inflow_overflow_clip.rs new file mode 100644 index 000000000..637c97c56 --- /dev/null +++ b/tests/generated/block/block_inflow_overflow_clip.rs @@ -0,0 +1,275 @@ +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 68f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 68f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 46f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 46f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_inflow_overflow_hidden.rs b/tests/generated/block/block_inflow_overflow_hidden.rs new file mode 100644 index 000000000..f5879ea83 --- /dev/null +++ b/tests/generated/block/block_inflow_overflow_hidden.rs @@ -0,0 +1,281 @@ +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 72f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 64f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 64f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_inflow_overflow_scroll.rs b/tests/generated/block/block_inflow_overflow_scroll.rs new file mode 100644 index 000000000..01249c865 --- /dev/null +++ b/tests/generated/block/block_inflow_overflow_scroll.rs @@ -0,0 +1,281 @@ +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 87f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 87f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 79f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 79f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 65f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_inflow_overflow_visible.rs b/tests/generated/block/block_inflow_overflow_visible.rs new file mode 100644 index 000000000..a670e31cf --- /dev/null +++ b/tests/generated/block/block_inflow_overflow_visible.rs @@ -0,0 +1,271 @@ +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 68f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 68f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn block_inflow_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 46f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 46f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/block/block_inset_fixed.rs b/tests/generated/block/block_inset_fixed.rs index 2885440f5..c74c592a0 100644 --- a/tests/generated/block/block_inset_fixed.rs +++ b/tests/generated/block/block_inset_fixed.rs @@ -44,30 +44,164 @@ fn block_inset_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 4f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 4f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node0, 2f32, location.x); - assert_eq!(location.y, 4f32, "y of node {:?}. Expected {}. Actual {}", node0, 4f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, -6f32, "x of node {:?}. Expected {}. Actual {}", node1, -6f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node1, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -6f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node2, 2f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node2, 24f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 24f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +254,162 @@ fn block_inset_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 4f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 4f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node0, 2f32, location.x); - assert_eq!(location.y, 4f32, "y of node {:?}. Expected {}. Actual {}", node0, 4f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, -6f32, "x of node {:?}. Expected {}. Actual {}", node1, -6f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node1, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -6f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node2, 2f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node2, 24f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 24f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_inset_percentage.rs b/tests/generated/block/block_inset_percentage.rs index ceb9c15da..1f1bddc86 100644 --- a/tests/generated/block/block_inset_percentage.rs +++ b/tests/generated/block/block_inset_percentage.rs @@ -54,30 +54,164 @@ fn block_inset_percentage__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, -3f32, "x of node {:?}. Expected {}. Actual {}", node1, -3f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node2, 1f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,28 +274,162 @@ fn block_inset_percentage__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, -3f32, "x of node {:?}. Expected {}. Actual {}", node1, -3f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node2, 1f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_intrinsic_width.rs b/tests/generated/block/block_intrinsic_width.rs index 95e685346..afc36cbe4 100644 --- a/tests/generated/block/block_intrinsic_width.rs +++ b/tests/generated/block/block_intrinsic_width.rs @@ -29,24 +29,125 @@ fn block_intrinsic_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +187,123 @@ fn block_intrinsic_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_item_max_width.rs b/tests/generated/block/block_item_max_width.rs index 2b3903333..7baba66a3 100644 --- a/tests/generated/block/block_item_max_width.rs +++ b/tests/generated/block/block_item_max_width.rs @@ -35,24 +35,125 @@ fn block_item_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,22 +196,123 @@ fn block_item_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_item_min_width_overrides_max_width.rs b/tests/generated/block/block_item_min_width_overrides_max_width.rs index fbf8a2a14..88b5e5929 100644 --- a/tests/generated/block/block_item_min_width_overrides_max_width.rs +++ b/tests/generated/block/block_item_min_width_overrides_max_width.rs @@ -29,18 +29,86 @@ fn block_item_min_width_overrides_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn block_item_min_width_overrides_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_item_text_align_center.rs b/tests/generated/block/block_item_text_align_center.rs index 17096346e..5da66b6c4 100644 --- a/tests/generated/block/block_item_text_align_center.rs +++ b/tests/generated/block/block_item_text_align_center.rs @@ -36,24 +36,125 @@ fn block_item_text_align_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +198,123 @@ fn block_item_text_align_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_item_text_align_left.rs b/tests/generated/block/block_item_text_align_left.rs index 63abf5384..7f37caba8 100644 --- a/tests/generated/block/block_item_text_align_left.rs +++ b/tests/generated/block/block_item_text_align_left.rs @@ -36,24 +36,125 @@ fn block_item_text_align_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +198,123 @@ fn block_item_text_align_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_item_text_align_right.rs b/tests/generated/block/block_item_text_align_right.rs index 3491f5da0..5b388de5c 100644 --- a/tests/generated/block/block_item_text_align_right.rs +++ b/tests/generated/block/block_item_text_align_right.rs @@ -36,24 +36,125 @@ fn block_item_text_align_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +198,123 @@ fn block_item_text_align_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_bottom.rs b/tests/generated/block/block_margin_auto_bottom.rs index a96c7f2e7..2186c3b8a 100644 --- a/tests/generated/block/block_margin_auto_bottom.rs +++ b/tests/generated/block/block_margin_auto_bottom.rs @@ -46,24 +46,125 @@ fn block_margin_auto_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn block_margin_auto_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bb03e457a..156aea55c 100644 --- a/tests/generated/block/block_margin_auto_bottom_and_top.rs +++ b/tests/generated/block/block_margin_auto_bottom_and_top.rs @@ -45,24 +45,125 @@ fn block_margin_auto_bottom_and_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn block_margin_auto_bottom_and_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_left.rs b/tests/generated/block/block_margin_auto_left.rs index 2c21bd02b..41cafd946 100644 --- a/tests/generated/block/block_margin_auto_left.rs +++ b/tests/generated/block/block_margin_auto_left.rs @@ -45,24 +45,125 @@ fn block_margin_auto_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node0, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn block_margin_auto_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node0, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 64c63fce1..6d3453196 100644 --- a/tests/generated/block/block_margin_auto_left_and_right.rs +++ b/tests/generated/block/block_margin_auto_left_and_right.rs @@ -45,24 +45,125 @@ fn block_margin_auto_left_and_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node0, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn block_margin_auto_left_and_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node0, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs b/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs index 8dab85b78..f81068851 100644 --- a/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs +++ b/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs @@ -40,18 +40,86 @@ fn block_margin_auto_left_and_right_with_auto_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,16 +166,84 @@ fn block_margin_auto_left_and_right_with_auto_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fd20d4f20..2f4f4ed0a 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 @@ -36,18 +36,86 @@ fn block_margin_auto_left_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn block_margin_auto_left_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cd7c146d1..66c4fc1e2 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 @@ -36,18 +36,86 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 539f69234..2e8067b07 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 @@ -36,18 +36,86 @@ fn block_margin_auto_left_right_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn block_margin_auto_left_right_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node0, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_multiple_children.rs b/tests/generated/block/block_margin_auto_multiple_children.rs index 075aee961..977d6e141 100644 --- a/tests/generated/block/block_margin_auto_multiple_children.rs +++ b/tests/generated/block/block_margin_auto_multiple_children.rs @@ -61,30 +61,164 @@ fn block_margin_auto_multiple_children__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -154,28 +288,162 @@ fn block_margin_auto_multiple_children__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_right.rs b/tests/generated/block/block_margin_auto_right.rs index f393ace3a..6fb0baa05 100644 --- a/tests/generated/block/block_margin_auto_right.rs +++ b/tests/generated/block/block_margin_auto_right.rs @@ -46,24 +46,125 @@ fn block_margin_auto_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn block_margin_auto_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_auto_top.rs b/tests/generated/block/block_margin_auto_top.rs index cc24183ea..ec4e734b3 100644 --- a/tests/generated/block/block_margin_auto_top.rs +++ b/tests/generated/block/block_margin_auto_top.rs @@ -46,24 +46,125 @@ fn block_margin_auto_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn block_margin_auto_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0635673d3..07b161088 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_bottom.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_bottom.rs @@ -39,24 +39,125 @@ fn block_margin_x_fixed_auto_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_x_fixed_auto_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 571e087d6..5b674da3d 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_left.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_left.rs @@ -39,24 +39,125 @@ fn block_margin_x_fixed_auto_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_x_fixed_auto_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c5c05dde3..6d4077612 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 @@ -39,24 +39,125 @@ fn block_margin_x_fixed_auto_left_and_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_x_fixed_auto_left_and_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c77c13385..1512b9b8c 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_right.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_right.rs @@ -39,24 +39,125 @@ fn block_margin_x_fixed_auto_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_x_fixed_auto_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3d75559b9..9d8687202 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_top.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_top.rs @@ -39,24 +39,125 @@ fn block_margin_x_fixed_auto_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_x_fixed_auto_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8b5a370fe..4bc8059d2 100644 --- a/tests/generated/block/block_margin_x_fixed_size_negative.rs +++ b/tests/generated/block/block_margin_x_fixed_size_negative.rs @@ -31,24 +31,125 @@ fn block_margin_x_fixed_size_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node0, 65f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,22 +188,123 @@ fn block_margin_x_fixed_size_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node0, 65f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0b153765c..47b5d87c2 100644 --- a/tests/generated/block/block_margin_x_fixed_size_positive.rs +++ b/tests/generated/block/block_margin_x_fixed_size_positive.rs @@ -31,24 +31,125 @@ fn block_margin_x_fixed_size_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,22 +188,123 @@ fn block_margin_x_fixed_size_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7dfadd532..24bcba523 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_negative.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_negative.rs @@ -27,24 +27,125 @@ fn block_margin_x_intrinsic_size_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node0, 15f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,22 +183,123 @@ fn block_margin_x_intrinsic_size_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node0, 15f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ae2846c72..0fcd34124 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_positive.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_positive.rs @@ -27,24 +27,125 @@ fn block_margin_x_intrinsic_size_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node, 15f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node1, 15f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,22 +183,123 @@ fn block_margin_x_intrinsic_size_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node, 15f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node1, 15f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ca161b10f..f9e893c2e 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 @@ -36,24 +36,125 @@ fn block_margin_x_percentage_fixed_size_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node0, 65f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +198,123 @@ fn block_margin_x_percentage_fixed_size_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node0, 65f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ecb7562a0..6ece45293 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 @@ -36,24 +36,125 @@ fn block_margin_x_percentage_fixed_size_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +198,123 @@ fn block_margin_x_percentage_fixed_size_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 35bc0c7ae..06ba51eea 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 @@ -35,24 +35,125 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node0, 130f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node0, -20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,22 +199,123 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node0, 130f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node0, -20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bf316afe8..00329c3f8 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 @@ -35,24 +35,125 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,22 +199,123 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9f5fa609e..e8e58aea8 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 @@ -29,18 +29,86 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node0, -20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,16 +147,84 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node0, -20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a23546d8f..392d6a4d9 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 @@ -29,18 +29,86 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,16 +147,84 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_y_collapse_complex.rs b/tests/generated/block/block_margin_y_collapse_complex.rs index 27a4a22c0..b7c73bef4 100644 --- a/tests/generated/block/block_margin_y_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_collapse_complex.rs @@ -75,54 +75,338 @@ fn block_margin_y_collapse_complex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node10, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node11, 7f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node12, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, -6f32, "y of node {:?}. Expected {}. Actual {}", node12, -6f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), -6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -210,52 +494,336 @@ fn block_margin_y_collapse_complex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node10, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node11, 7f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node12, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, -6f32, "y of node {:?}. Expected {}. Actual {}", node12, -6f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), -6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 44ab4173c..3a8be004e 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 @@ -42,30 +42,164 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b83565b6d..ae9c1c839 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 @@ -41,30 +41,164 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 81a787c67..9c834d441 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 @@ -41,30 +41,164 @@ fn block_margin_y_collapse_through_blocked_by_border_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn block_margin_y_collapse_through_blocked_by_border_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e8cb89cca..7458bbf8b 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 @@ -42,30 +42,164 @@ fn block_margin_y_collapse_through_blocked_by_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn block_margin_y_collapse_through_blocked_by_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 afc74f8c4..7f61d3d9d 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 @@ -49,30 +49,164 @@ fn block_margin_y_collapse_through_blocked_by_line_box__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -130,28 +264,162 @@ fn block_margin_y_collapse_through_blocked_by_line_box__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 63d21bff2..84b2eee09 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 @@ -50,30 +50,164 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__border_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -132,28 +266,162 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__content println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ef7454970..2881792da 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 @@ -50,30 +50,164 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__bor println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -132,28 +266,162 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__con println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6d62f4478..a5a8cdd07 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 @@ -42,30 +42,164 @@ fn block_margin_y_collapse_through_blocked_by_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn block_margin_y_collapse_through_blocked_by_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fde281837..f34947662 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 @@ -43,48 +43,164 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,46 +252,162 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cbd0f8c9e..7d21ef7a9 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 @@ -43,48 +43,164 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 55f32, "height of node {:?}. Expected {}. Actual {}", node, 55f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 55f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node1, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,46 +252,162 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 55f32, "height of node {:?}. Expected {}. Actual {}", node, 55f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 55f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node1, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 73d1abc1e..84db733a6 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 @@ -43,48 +43,164 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,46 +252,162 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9486ecbda..7268a8c84 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 @@ -43,48 +43,164 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,46 +252,162 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 19a394d88..f1839fbb2 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 @@ -42,30 +42,164 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fca166177..f7fe5662d 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 @@ -42,30 +42,164 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node, 41f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node1, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 1f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node2, 31f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c2c2583bf..092970bb5 100644 --- a/tests/generated/block/block_margin_y_collapse_through_negative.rs +++ b/tests/generated/block/block_margin_y_collapse_through_negative.rs @@ -41,30 +41,164 @@ fn block_margin_y_collapse_through_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 13f32, "height of node {:?}. Expected {}. Actual {}", node, 13f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 13f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node1, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node2, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn block_margin_y_collapse_through_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 13f32, "height of node {:?}. Expected {}. Actual {}", node, 13f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 13f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node1, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node2, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b20cc4906..65647b883 100644 --- a/tests/generated/block/block_margin_y_collapse_through_positive.rs +++ b/tests/generated/block/block_margin_y_collapse_through_positive.rs @@ -41,30 +41,164 @@ fn block_margin_y_collapse_through_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn block_margin_y_collapse_through_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f43dc77c4..e6cd4f3ad 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 @@ -41,30 +41,164 @@ fn block_margin_y_collapse_through_positive_and_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node2, 7f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn block_margin_y_collapse_through_positive_and_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node2, 7f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b10bfccc9..5dd8afa37 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 @@ -55,36 +55,209 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,34 +325,207 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e6ab060c9..0b9bb286a 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ddffccdd3..91ec8caa7 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 @@ -49,48 +49,176 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5789c3635..7bb44bc4f 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 @@ -49,48 +49,176 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 661876afa..52878665c 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 @@ -49,48 +49,176 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d2dd3ef09..059e7d6a0 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 @@ -49,48 +49,176 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node00, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node000, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node00, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node000, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 154c9725a..4f31b9de1 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 @@ -45,30 +45,176 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node0, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node00, 11f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +268,174 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node0, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node00, 11f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 204b242b5..651763b77 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_negative_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_negative_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 65630a707..c71370180 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e1139d8ff..9e9263a55 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 aeee9cffe..33def4e59 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 78b557afd..7758fb4b5 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 @@ -45,30 +45,176 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__border_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 11f32, "height of node {:?}. Expected {}. Actual {}", node0, 11f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 11f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +268,174 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__content_bo println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 11f32, "height of node {:?}. Expected {}. Actual {}", node0, 11f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 11f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 97e5d4198..ee0d19cb7 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 @@ -96,66 +96,434 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -266,64 +634,432 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 31f71c98a..d89c8bca0 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_positive_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_positive_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 448d7102c..0d19b8965 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 146b8f58b..f20112def 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 @@ -44,30 +44,176 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a3d775ca6..0ff809734 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 @@ -126,84 +126,587 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -347,82 +850,585 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 864d3e2d0..ef633b313 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 @@ -54,36 +54,227 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,34 +338,225 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1c70fbe4d..76a51a7f2 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8fd5a69b6..d0bca3451 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 @@ -49,48 +49,176 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__content_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6dad4f277..3e474bf7c 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 @@ -49,48 +49,176 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__content_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a4c6f8ea9..c86082342 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 @@ -49,48 +49,176 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__content_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bb50a0fa6..2ae74fbca 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 @@ -49,48 +49,176 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node00, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node000, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,46 +276,174 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__content_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node00, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node000, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fd3df03c6..7ce955619 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 @@ -45,30 +45,176 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node0, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +268,174 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node0, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 64fcf2f60..2219ed944 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_negative_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_negative_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7252bad38..bb87dc4f3 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1f7c99eab..9219bc83e 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5e213b840..9d15edb8e 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6968aab39..f5cc867c8 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 @@ -45,30 +45,176 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 11f32, "height of node {:?}. Expected {}. Actual {}", node0, 11f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 11f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +268,174 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__content_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 21f32, "height of node {:?}. Expected {}. Actual {}", node, 21f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 21f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 11f32, "height of node {:?}. Expected {}. Actual {}", node0, 11f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 11f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4d8fa8c2e..af5520ace 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 @@ -96,66 +96,434 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node2, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -266,64 +634,432 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node100, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node2, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node200).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node200, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node200, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node200, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node200, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node200, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node200, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1ac41b310..debdf14eb 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_positive_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_positive_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ce3f70d4d..5200fd1f2 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ba55991d0..e61ea4cb4 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 @@ -44,30 +44,176 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ee4f0c6a9..e844e1349 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 @@ -54,36 +54,227 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,34 +338,225 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 50f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 234306260..a2cd7372d 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_negative.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_negative.rs @@ -46,36 +46,203 @@ fn block_margin_y_sibling_collapse_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -131,34 +298,201 @@ fn block_margin_y_sibling_collapse_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f353cd396..7e90ca35d 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 @@ -66,36 +66,203 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -171,34 +338,201 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dccebaeed..eac042235 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive.rs @@ -46,36 +46,203 @@ fn block_margin_y_sibling_collapse_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -131,34 +298,201 @@ fn block_margin_y_sibling_collapse_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 399cd39df..aa21ac637 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 @@ -67,54 +67,320 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node2, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node5, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node6, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node6, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -194,52 +460,318 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node2, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node5, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node6, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node6, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 392715dcd..24b092e2d 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 @@ -102,54 +102,320 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 28f32, "y of node {:?}. Expected {}. Actual {}", node2, 28f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 28f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node3, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node4, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 53f32, "y of node {:?}. Expected {}. Actual {}", node5, 53f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 53f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node6, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node6, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -264,52 +530,318 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 28f32, "y of node {:?}. Expected {}. Actual {}", node2, 28f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 28f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node3, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node4, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 53f32, "y of node {:?}. Expected {}. Actual {}", node5, 53f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 53f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node6, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node6, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bf1e4a3de..c6be6345e 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 @@ -66,36 +66,203 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node2, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -171,34 +338,201 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node2, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_y_simple_negative.rs b/tests/generated/block/block_margin_y_simple_negative.rs index 9bfdbcb1f..6294a3cc4 100644 --- a/tests/generated/block/block_margin_y_simple_negative.rs +++ b/tests/generated/block/block_margin_y_simple_negative.rs @@ -31,24 +31,125 @@ fn block_margin_y_simple_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,22 +188,123 @@ fn block_margin_y_simple_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f7c7ae73f..9395d7bfb 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 @@ -39,24 +39,125 @@ fn block_margin_y_simple_negative_percentage_other__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_y_simple_negative_percentage_other__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ed8d83092..217cee67e 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 @@ -39,24 +39,125 @@ fn block_margin_y_simple_negative_percentage_self__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_margin_y_simple_negative_percentage_self__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_y_simple_positive.rs b/tests/generated/block/block_margin_y_simple_positive.rs index 05d8ec89e..fbf35332a 100644 --- a/tests/generated/block/block_margin_y_simple_positive.rs +++ b/tests/generated/block/block_margin_y_simple_positive.rs @@ -31,24 +31,125 @@ fn block_margin_y_simple_positive__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,22 +188,123 @@ fn block_margin_y_simple_positive__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 143e755ad..46f1c0a5a 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 @@ -35,24 +35,125 @@ fn block_margin_y_simple_positive_percentage_other__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,22 +199,123 @@ fn block_margin_y_simple_positive_percentage_other__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ad04760bd..1d8599e44 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 @@ -35,24 +35,125 @@ fn block_margin_y_simple_positive_percentage_self__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,22 +199,123 @@ fn block_margin_y_simple_positive_percentage_self__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_margin_y_total_collapse.rs b/tests/generated/block/block_margin_y_total_collapse.rs index fc156a130..581863e78 100644 --- a/tests/generated/block/block_margin_y_total_collapse.rs +++ b/tests/generated/block/block_margin_y_total_collapse.rs @@ -57,36 +57,215 @@ fn block_margin_y_total_collapse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +332,213 @@ fn block_margin_y_total_collapse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 de85d35d7..ae37fe729 100644 --- a/tests/generated/block/block_margin_y_total_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_total_collapse_complex.rs @@ -75,54 +75,338 @@ fn block_margin_y_total_collapse_complex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node10, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node11, 7f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node12, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, -6f32, "y of node {:?}. Expected {}. Actual {}", node12, -6f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), -6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -210,52 +494,336 @@ fn block_margin_y_total_collapse_complex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node1, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node10, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 7f32, "y of node {:?}. Expected {}. Actual {}", node11, 7f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 7f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node12, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, -6f32, "y of node {:?}. Expected {}. Actual {}", node12, -6f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), -6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node2, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node3, -10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs index 9fc1b9a2f..902161a11 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs @@ -47,42 +47,125 @@ fn block_overflow_scrollbars_overridden_by_available_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 11f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 11f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node0, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -137,40 +220,123 @@ fn block_overflow_scrollbars_overridden_by_available_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 11f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 11f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node0, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs index f0ecff3b8..124b3b061 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs @@ -38,36 +38,86 @@ fn block_overflow_scrollbars_overridden_by_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,34 +162,84 @@ fn block_overflow_scrollbars_overridden_by_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs index 09a097fea..85a9562f7 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs @@ -38,36 +38,86 @@ fn block_overflow_scrollbars_overridden_by_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,34 +162,84 @@ fn block_overflow_scrollbars_overridden_by_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2d1a7873d..099742c38 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 @@ -38,36 +38,86 @@ fn block_overflow_scrollbars_take_up_space_both_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,34 +162,84 @@ fn block_overflow_scrollbars_take_up_space_both_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c91e17271..c008ab3d4 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 @@ -38,36 +38,86 @@ fn block_overflow_scrollbars_take_up_space_cross_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,34 +162,84 @@ fn block_overflow_scrollbars_take_up_space_cross_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1111ccdac..d791b52e6 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 @@ -38,36 +38,86 @@ fn block_overflow_scrollbars_take_up_space_main_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,34 +162,84 @@ fn block_overflow_scrollbars_take_up_space_main_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_border_fixed_size.rs b/tests/generated/block/block_padding_border_fixed_size.rs index 9577d3f35..79f4488c8 100644 --- a/tests/generated/block/block_padding_border_fixed_size.rs +++ b/tests/generated/block/block_padding_border_fixed_size.rs @@ -45,24 +45,125 @@ fn block_padding_border_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node0, 28f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node1, 28f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node1, 15f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn block_padding_border_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node, 72f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node1, 15f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_border_intrinsic_size.rs b/tests/generated/block/block_padding_border_intrinsic_size.rs index 86aa6f869..291d0287b 100644 --- a/tests/generated/block/block_padding_border_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_intrinsic_size.rs @@ -44,24 +44,125 @@ fn block_padding_border_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node, 72f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node, 34f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node1, 15f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -113,22 +214,123 @@ fn block_padding_border_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node, 72f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node, 34f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node1, 15f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3a28a33f0..660c5e336 100644 --- a/tests/generated/block/block_padding_border_overrides_max_size.rs +++ b/tests/generated/block/block_padding_border_overrides_max_size.rs @@ -40,24 +40,125 @@ fn block_padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +210,123 @@ fn block_padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4e3c977bb..0daa91b6a 100644 --- a/tests/generated/block/block_padding_border_overrides_min_size.rs +++ b/tests/generated/block/block_padding_border_overrides_min_size.rs @@ -40,24 +40,125 @@ fn block_padding_border_overrides_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +210,123 @@ fn block_padding_border_overrides_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_border_overrides_size.rs b/tests/generated/block/block_padding_border_overrides_size.rs index 4f8a5bb3a..6e73976fd 100644 --- a/tests/generated/block/block_padding_border_overrides_size.rs +++ b/tests/generated/block/block_padding_border_overrides_size.rs @@ -40,24 +40,125 @@ fn block_padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +210,123 @@ fn block_padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node00, 12f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00, 3f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 09c2c3247..30cb19417 100644 --- a/tests/generated/block/block_padding_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_border_percentage_fixed_size.rs @@ -43,24 +43,131 @@ fn block_padding_border_percentage_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 47f32, "width of node {:?}. Expected {}. Actual {}", node00, 47f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node00, 2f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 47f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 47f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -111,22 +218,129 @@ fn block_padding_border_percentage_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 47f32, "width of node {:?}. Expected {}. Actual {}", node00, 47f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node00, 2f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 47f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 47f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 31ecd9b91..baf1acfb6 100644 --- a/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs @@ -36,24 +36,131 @@ fn block_padding_border_percentage_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,22 +207,129 @@ fn block_padding_border_percentage_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_fixed_size.rs b/tests/generated/block/block_padding_fixed_size.rs index 4e7ebee65..06dfbaf63 100644 --- a/tests/generated/block/block_padding_fixed_size.rs +++ b/tests/generated/block/block_padding_fixed_size.rs @@ -39,24 +39,125 @@ fn block_padding_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 38f32, "width of node {:?}. Expected {}. Actual {}", node0, 38f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 38f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 38f32, "width of node {:?}. Expected {}. Actual {}", node1, 38f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 38f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn block_padding_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 58f32, "height of node {:?}. Expected {}. Actual {}", node, 58f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 58f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 58f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_intrinsic_size.rs b/tests/generated/block/block_padding_intrinsic_size.rs index c0ffbfe10..e07e15bac 100644 --- a/tests/generated/block/block_padding_intrinsic_size.rs +++ b/tests/generated/block/block_padding_intrinsic_size.rs @@ -38,24 +38,125 @@ fn block_padding_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 28f32, "height of node {:?}. Expected {}. Actual {}", node, 28f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 28f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn block_padding_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 28f32, "height of node {:?}. Expected {}. Actual {}", node, 28f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 28f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_percentage_fixed_size.rs b/tests/generated/block/block_padding_percentage_fixed_size.rs index 9becb8793..cdc740c6c 100644 --- a/tests/generated/block/block_padding_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_percentage_fixed_size.rs @@ -43,24 +43,131 @@ fn block_padding_percentage_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 47f32, "width of node {:?}. Expected {}. Actual {}", node00, 47f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node00, 2f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 47f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 47f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -111,22 +218,129 @@ fn block_padding_percentage_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 47f32, "width of node {:?}. Expected {}. Actual {}", node00, 47f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node00, 2f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node00, 1f32, location.y); + if layout.size.width != 47f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 47f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/block_padding_percentage_intrinsic_size.rs b/tests/generated/block/block_padding_percentage_intrinsic_size.rs index 59a859c18..004371b3e 100644 --- a/tests/generated/block/block_padding_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_percentage_intrinsic_size.rs @@ -36,24 +36,131 @@ fn block_padding_percentage_intrinsic_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,22 +207,129 @@ fn block_padding_percentage_intrinsic_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/block/mod.rs b/tests/generated/block/mod.rs index 621d0358a..22abfba5e 100644 --- a/tests/generated/block/mod.rs +++ b/tests/generated/block/mod.rs @@ -50,6 +50,10 @@ mod block_absolute_minmax_bottom_right_min_max_preferred; mod block_absolute_minmax_top_left_bottom_right_max; mod block_absolute_minmax_top_left_bottom_right_min_max; mod block_absolute_no_styles; +mod block_absolute_overflow_clip; +mod block_absolute_overflow_hidden; +mod block_absolute_overflow_scroll; +mod block_absolute_overflow_visible; mod block_absolute_padding_border_overrides_max_size; mod block_absolute_padding_border_overrides_size; mod block_absolute_resolved_insets; @@ -76,6 +80,10 @@ mod block_display_none_with_child; mod block_display_none_with_inset; mod block_display_none_with_margin; mod block_display_none_with_position_absolute; +mod block_inflow_overflow_clip; +mod block_inflow_overflow_hidden; +mod block_inflow_overflow_scroll; +mod block_inflow_overflow_visible; mod block_inset_fixed; mod block_inset_percentage; mod block_intrinsic_width; diff --git a/tests/generated/blockflex/blockflex_block_in_flex_column.rs b/tests/generated/blockflex/blockflex_block_in_flex_column.rs index 0db3c8eb1..f2328dcae 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_column.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_column.rs @@ -31,24 +31,125 @@ fn blockflex_block_in_flex_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +192,123 @@ fn blockflex_block_in_flex_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockflex/blockflex_block_in_flex_row.rs b/tests/generated/blockflex/blockflex_block_in_flex_row.rs index 84f182983..28f661bc2 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_row.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_row.rs @@ -30,24 +30,125 @@ fn blockflex_block_in_flex_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -89,22 +190,123 @@ fn blockflex_block_in_flex_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockflex/blockflex_flex_in_block.rs b/tests/generated/blockflex/blockflex_flex_in_block.rs index df3926aef..4c5c142d6 100644 --- a/tests/generated/blockflex/blockflex_flex_in_block.rs +++ b/tests/generated/blockflex/blockflex_flex_in_block.rs @@ -43,30 +43,170 @@ fn blockflex_flex_in_block__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -121,28 +261,168 @@ fn blockflex_flex_in_block__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6b46ace17..b1639f9a9 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 @@ -41,30 +41,164 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1ea843bc0..06020e20e 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 @@ -44,30 +44,176 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5b6875358..d72e07f20 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 @@ -44,30 +44,176 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockflex/blockflex_overflow_hidden.rs b/tests/generated/blockflex/blockflex_overflow_hidden.rs index cbe5d151b..2c6b2c705 100644 --- a/tests/generated/blockflex/blockflex_overflow_hidden.rs +++ b/tests/generated/blockflex/blockflex_overflow_hidden.rs @@ -42,42 +42,125 @@ fn blockflex_overflow_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 40f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 40f32, - layout.scroll_width() - ); + if layout.scroll_width() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 40f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -131,40 +214,123 @@ fn blockflex_overflow_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 40f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 40f32, - layout.scroll_width() - ); + if layout.scroll_width() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 40f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs index 927e4e833..988993db6 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_auto__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_auto__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 98cbf7d90..8e537b382 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 @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 74ca2179c..299aeb8a4 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 @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 70bb22308..7f5c705b7 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 @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 36a2853ce..269c7ab09 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_larger__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_larger__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 57c450047..34fc6a3a7 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_middle__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_middle__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e898da266..91d5c0648 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fixed_smaller__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fixed_smaller__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs index b2dbb149c..8e3f39571 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_fr__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_fr__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2ca4879fb..968c7aea2 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 89d95c721..dc621f3f0 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs @@ -26,24 +26,125 @@ fn blockgrid_block_in_grid_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn blockgrid_block_in_grid_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/blockgrid/blockgrid_grid_in_block.rs b/tests/generated/blockgrid/blockgrid_grid_in_block.rs index 24cb8fe01..6d6e2c24e 100644 --- a/tests/generated/blockgrid/blockgrid_grid_in_block.rs +++ b/tests/generated/blockgrid/blockgrid_grid_in_block.rs @@ -43,30 +43,170 @@ fn blockgrid_grid_in_block__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -121,28 +261,168 @@ fn blockgrid_grid_in_block__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 507572734..583f3d37f 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 @@ -41,30 +41,164 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +248,162 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 875565562..5ed95647d 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 @@ -44,30 +44,176 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 535be2a6c..6520f47c4 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 @@ -44,30 +44,176 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +266,174 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c515643da..c79668574 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 @@ -34,18 +34,92 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__border_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__content_bo println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs index 1537ce196..fadb2b3bd 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs @@ -35,18 +35,86 @@ fn absolute_aspect_ratio_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn absolute_aspect_ratio_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 83a71b6fe..6dc009f8f 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 @@ -34,18 +34,92 @@ fn absolute_aspect_ratio_fill_height_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn absolute_aspect_ratio_fill_height_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 22a1acdd7..3bce2000d 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs @@ -4,6 +4,8 @@ fn absolute_aspect_ratio_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -12,10 +14,7 @@ fn absolute_aspect_ratio_fill_max_height__border_box() { aspect_ratio: Some(3f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -35,18 +34,86 @@ fn absolute_aspect_ratio_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 73f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 73f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,6 +122,8 @@ fn absolute_aspect_ratio_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -64,10 +133,7 @@ fn absolute_aspect_ratio_fill_max_height__content_box() { aspect_ratio: Some(3f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -88,16 +154,84 @@ fn absolute_aspect_ratio_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 73f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 73f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 233dc0966..1fc95f02c 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs @@ -4,6 +4,8 @@ fn absolute_aspect_ratio_fill_max_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -12,10 +14,7 @@ fn absolute_aspect_ratio_fill_max_width__border_box() { aspect_ratio: Some(0.5f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -35,18 +34,86 @@ fn absolute_aspect_ratio_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,6 +122,8 @@ fn absolute_aspect_ratio_fill_max_width__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); + let node0_text = + "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"; let node0 = taffy .new_leaf_with_context( taffy::style::Style { @@ -64,10 +133,7 @@ fn absolute_aspect_ratio_fill_max_width__content_box() { aspect_ratio: Some(0.5f32), ..Default::default() }, - crate::TestNodeContext::ahem_text( - "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::WritingMode::Horizontal, - ), + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy @@ -88,16 +154,84 @@ fn absolute_aspect_ratio_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 729c9ab16..da681b585 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs @@ -29,18 +29,86 @@ fn absolute_aspect_ratio_fill_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn absolute_aspect_ratio_fill_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 17f32, "height of node {:?}. Expected {}. Actual {}", node0, 17f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 17f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f57c9cb4f..e6d4087d3 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs @@ -29,18 +29,86 @@ fn absolute_aspect_ratio_fill_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn absolute_aspect_ratio_fill_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node0, 25f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs index 77e543bd8..4034ef61e 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs @@ -35,18 +35,86 @@ fn absolute_aspect_ratio_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn absolute_aspect_ratio_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cfc008610..2f4af5598 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 @@ -29,18 +29,86 @@ fn absolute_aspect_ratio_fill_width_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn absolute_aspect_ratio_fill_width_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 279d8c6b6..97f68659f 100644 --- a/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs @@ -30,18 +30,86 @@ fn absolute_aspect_ratio_height_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn absolute_aspect_ratio_height_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 345a5cb77..58292ab42 100644 --- a/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs @@ -35,18 +35,86 @@ fn absolute_aspect_ratio_width_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn absolute_aspect_ratio_width_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_child_with_cross_margin.rs b/tests/generated/flex/absolute_child_with_cross_margin.rs index a8a728872..2e9a2b984 100644 --- a/tests/generated/flex/absolute_child_with_cross_margin.rs +++ b/tests/generated/flex/absolute_child_with_cross_margin.rs @@ -62,30 +62,164 @@ fn absolute_child_with_cross_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 311f32, "width of node {:?}. Expected {}. Actual {}", node, 311f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node, 27f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 311f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 311f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node0, 28f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node0, 27f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 311f32, "width of node {:?}. Expected {}. Actual {}", node1, 311f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node1, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 4f32, "y of node {:?}. Expected {}. Actual {}", node1, 4f32, location.y); + if layout.size.width != 311f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 311f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node2, 25f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node2, 27f32, size.height); - assert_eq!(location.x, 286f32, "x of node {:?}. Expected {}. Actual {}", node2, 286f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 286f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 286f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -156,28 +290,162 @@ fn absolute_child_with_cross_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 311f32, "width of node {:?}. Expected {}. Actual {}", node, 311f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node, 27f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 311f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 311f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node0, 28f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node0, 27f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 311f32, "width of node {:?}. Expected {}. Actual {}", node1, 311f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node1, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 4f32, "y of node {:?}. Expected {}. Actual {}", node1, 4f32, location.y); + if layout.size.width != 311f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 311f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 15f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node2, 25f32, size.width); - assert_eq!(size.height, 27f32, "height of node {:?}. Expected {}. Actual {}", node2, 27f32, size.height); - assert_eq!(location.x, 286f32, "x of node {:?}. Expected {}. Actual {}", node2, 286f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 27f32, layout.size.height); + } + if layout.location.x != 286f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 286f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_child_with_main_margin.rs b/tests/generated/flex/absolute_child_with_main_margin.rs index fa235b01d..b9512aa7d 100644 --- a/tests/generated/flex/absolute_child_with_main_margin.rs +++ b/tests/generated/flex/absolute_child_with_main_margin.rs @@ -31,18 +31,86 @@ fn absolute_child_with_main_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 7f32, "x of node {:?}. Expected {}. Actual {}", node0, 7f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_child_with_main_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 37f32, "height of node {:?}. Expected {}. Actual {}", node, 37f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 37f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 9f32, "height of node {:?}. Expected {}. Actual {}", node0, 9f32, size.height); - assert_eq!(location.x, 7f32, "x of node {:?}. Expected {}. Actual {}", node0, 7f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 9f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_child_with_max_height.rs b/tests/generated/flex/absolute_child_with_max_height.rs index 7618dd50a..6c327b822 100644 --- a/tests/generated/flex/absolute_child_with_max_height.rs +++ b/tests/generated/flex/absolute_child_with_max_height.rs @@ -42,24 +42,131 @@ fn absolute_child_with_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node0, 150f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node00, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +216,129 @@ fn absolute_child_with_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node0, 150f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node00, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 86d1792fe..33db873c3 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 @@ -41,24 +41,137 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -107,22 +220,135 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dc9722cba..37d90d66c 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 @@ -32,18 +32,86 @@ fn absolute_layout_align_items_and_justify_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn absolute_layout_align_items_and_justify_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a5a9ed8b0..aae466ac7 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 @@ -33,18 +33,86 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__b println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__c println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e33415900..ee6ec7989 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 @@ -33,18 +33,86 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__bor println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__con println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 45086afc6..35a6478ef 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 @@ -33,18 +33,86 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__bo println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node0, 45f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__co println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node0, 45f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3766236ae..2750a1b39 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 @@ -33,18 +33,86 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__bord println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__cont println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b814da5db..d9146b066 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 @@ -32,18 +32,86 @@ fn absolute_layout_align_items_and_justify_content_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn absolute_layout_align_items_and_justify_content_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_align_items_center.rs b/tests/generated/flex/absolute_layout_align_items_center.rs index fa9ff983a..29a16f0c9 100644 --- a/tests/generated/flex/absolute_layout_align_items_center.rs +++ b/tests/generated/flex/absolute_layout_align_items_center.rs @@ -31,18 +31,86 @@ fn absolute_layout_align_items_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_align_items_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1cb6f78b1..f3b513980 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 @@ -31,18 +31,86 @@ fn absolute_layout_align_items_center_on_child_only__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_align_items_center_on_child_only__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_child_order.rs b/tests/generated/flex/absolute_layout_child_order.rs index 24ef2803b..346424846 100644 --- a/tests/generated/flex/absolute_layout_child_order.rs +++ b/tests/generated/flex/absolute_layout_child_order.rs @@ -50,30 +50,164 @@ fn absolute_layout_child_order__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node0, 55f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node1, 25f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node2, 55f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node2, 55f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -132,28 +266,162 @@ fn absolute_layout_child_order__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node0, 55f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node1, 25f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node2, 55f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node2, 55f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8eceda733..7c7377e50 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 @@ -32,18 +32,86 @@ fn absolute_layout_in_wrap_reverse_column_container__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn absolute_layout_in_wrap_reverse_column_container__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 da1126e0c..cd021fb54 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 @@ -33,18 +33,86 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fead69dee..0913a46ee 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 @@ -31,18 +31,86 @@ fn absolute_layout_in_wrap_reverse_row_container__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_in_wrap_reverse_row_container__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1a191c65d..e50169c99 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 @@ -32,18 +32,86 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_justify_content_center.rs b/tests/generated/flex/absolute_layout_justify_content_center.rs index 1f221c425..e7e81d4ba 100644 --- a/tests/generated/flex/absolute_layout_justify_content_center.rs +++ b/tests/generated/flex/absolute_layout_justify_content_center.rs @@ -31,18 +31,86 @@ fn absolute_layout_justify_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_justify_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_no_size.rs b/tests/generated/flex/absolute_layout_no_size.rs index a2739be35..ace7d970c 100644 --- a/tests/generated/flex/absolute_layout_no_size.rs +++ b/tests/generated/flex/absolute_layout_no_size.rs @@ -23,18 +23,86 @@ fn absolute_layout_no_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn absolute_layout_no_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0a51b9b00..f2e39c3e9 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 @@ -50,30 +50,170 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node2, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -132,28 +272,168 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node2, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_percentage_height.rs b/tests/generated/flex/absolute_layout_percentage_height.rs index 0be60f7c5..8a2b3a375 100644 --- a/tests/generated/flex/absolute_layout_percentage_height.rs +++ b/tests/generated/flex/absolute_layout_percentage_height.rs @@ -31,18 +31,86 @@ fn absolute_layout_percentage_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_percentage_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1cb45511b..a36145cdc 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 @@ -31,18 +31,86 @@ fn absolute_layout_row_width_height_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_row_width_height_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 800ccf4b4..2cb41e07a 100644 --- a/tests/generated/flex/absolute_layout_start_top_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_start_top_end_bottom.rs @@ -32,18 +32,86 @@ fn absolute_layout_start_top_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn absolute_layout_start_top_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 25a078662..ad31ec484 100644 --- a/tests/generated/flex/absolute_layout_width_height_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_width_height_end_bottom.rs @@ -31,18 +31,86 @@ fn absolute_layout_width_height_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_width_height_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 55c6ffb33..349500206 100644 --- a/tests/generated/flex/absolute_layout_width_height_start_top.rs +++ b/tests/generated/flex/absolute_layout_width_height_start_top.rs @@ -31,18 +31,86 @@ fn absolute_layout_width_height_start_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn absolute_layout_width_height_start_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ad3da7259..1cff15f44 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 @@ -36,18 +36,86 @@ fn absolute_layout_width_height_start_top_end_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn absolute_layout_width_height_start_top_end_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_layout_within_border.rs b/tests/generated/flex/absolute_layout_within_border.rs index a18615067..76affcc95 100644 --- a/tests/generated/flex/absolute_layout_within_border.rs +++ b/tests/generated/flex/absolute_layout_within_border.rs @@ -88,36 +88,203 @@ fn absolute_layout_within_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -215,34 +382,201 @@ fn absolute_layout_within_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node3, 70f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_margin_bottom_left.rs b/tests/generated/flex/absolute_margin_bottom_left.rs index cf0c4be64..d05ed159b 100644 --- a/tests/generated/flex/absolute_margin_bottom_left.rs +++ b/tests/generated/flex/absolute_margin_bottom_left.rs @@ -33,18 +33,86 @@ fn absolute_margin_bottom_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_margin_bottom_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_minmax_bottom_right_max.rs b/tests/generated/flex/absolute_minmax_bottom_right_max.rs index 251951d12..4719a810b 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_max.rs @@ -35,18 +35,86 @@ fn absolute_minmax_bottom_right_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn absolute_minmax_bottom_right_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5bf48fc02..6d998b0e5 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs @@ -35,18 +35,86 @@ fn absolute_minmax_bottom_right_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn absolute_minmax_bottom_right_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 650e08728..0753b4775 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 @@ -39,18 +39,86 @@ fn absolute_minmax_bottom_right_min_max_preferred__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,16 +164,84 @@ fn absolute_minmax_bottom_right_min_max_preferred__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8f720c317..df31a06b4 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 @@ -36,18 +36,86 @@ fn absolute_minmax_top_left_bottom_right_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn absolute_minmax_top_left_bottom_right_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7bb8cc287..18b352c44 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 @@ -40,18 +40,86 @@ fn absolute_minmax_top_left_bottom_right_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,16 +166,84 @@ fn absolute_minmax_top_left_bottom_right_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 64865053d..2ed96c2f4 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_max_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_max_size.rs @@ -31,18 +31,86 @@ fn absolute_padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_padding_border_overrides_size.rs b/tests/generated/flex/absolute_padding_border_overrides_size.rs index 772ed658a..640fad247 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_size.rs @@ -31,18 +31,86 @@ fn absolute_padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 22f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 14f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn absolute_padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 34f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 34f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 26f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/absolute_resolved_insets.rs b/tests/generated/flex/absolute_resolved_insets.rs index ce7ba0e6f..b4807a548 100644 --- a/tests/generated/flex/absolute_resolved_insets.rs +++ b/tests/generated/flex/absolute_resolved_insets.rs @@ -166,114 +166,617 @@ fn absolute_resolved_insets__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 165f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -463,112 +966,615 @@ fn absolute_resolved_insets__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 540f32, "width of node {:?}. Expected {}. Actual {}", node, 540f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 540f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 540f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 270f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node0, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node0, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node00, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node00, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node02, 250f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node02, 250f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 230f32, "width of node {:?}. Expected {}. Actual {}", node05, 230f32, size.width); - assert_eq!(size.height, 230f32, "height of node {:?}. Expected {}. Actual {}", node05, 230f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 230f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 230f32, layout.size.width); + } + if layout.size.height != 230f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 230f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node1, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node1, 270f32, size.height); - assert_eq!(location.x, 270f32, "x of node {:?}. Expected {}. Actual {}", node1, 270f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 270f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node10, 35f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node10, 35f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 235f32, "x of node {:?}. Expected {}. Actual {}", node12, 235f32, location.x); - assert_eq!(location.y, 235f32, "y of node {:?}. Expected {}. Actual {}", node12, 235f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 235f32, layout.location.x); + } + if layout.location.y != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 235f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 215f32, "width of node {:?}. Expected {}. Actual {}", node15, 215f32, size.width); - assert_eq!(size.height, 215f32, "height of node {:?}. Expected {}. Actual {}", node15, 215f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 215f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 215f32, layout.size.width); + } + if layout.size.height != 215f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 215f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline.rs b/tests/generated/flex/align_baseline.rs index 6546eb862..cf08125b5 100644 --- a/tests/generated/flex/align_baseline.rs +++ b/tests/generated/flex/align_baseline.rs @@ -39,24 +39,125 @@ fn align_baseline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn align_baseline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child.rs b/tests/generated/flex/align_baseline_child.rs index 7f1275c97..24306cfe8 100644 --- a/tests/generated/flex/align_baseline_child.rs +++ b/tests/generated/flex/align_baseline_child.rs @@ -52,30 +52,170 @@ fn align_baseline_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,28 +276,168 @@ fn align_baseline_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_margin.rs b/tests/generated/flex/align_baseline_child_margin.rs index 043519079..3880fa3a1 100644 --- a/tests/generated/flex/align_baseline_child_margin.rs +++ b/tests/generated/flex/align_baseline_child_margin.rs @@ -64,30 +64,170 @@ fn align_baseline_child_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -160,28 +300,168 @@ fn align_baseline_child_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_margin_percent.rs b/tests/generated/flex/align_baseline_child_margin_percent.rs index 1264e859a..773d9e985 100644 --- a/tests/generated/flex/align_baseline_child_margin_percent.rs +++ b/tests/generated/flex/align_baseline_child_margin_percent.rs @@ -64,30 +64,170 @@ fn align_baseline_child_margin_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -160,28 +300,168 @@ fn align_baseline_child_margin_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_multiline.rs b/tests/generated/flex/align_baseline_child_multiline.rs index ff39590d4..01f735861 100644 --- a/tests/generated/flex/align_baseline_child_multiline.rs +++ b/tests/generated/flex/align_baseline_child_multiline.rs @@ -73,48 +73,305 @@ fn align_baseline_child_multiline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -199,46 +456,303 @@ fn align_baseline_child_multiline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a24fdfba4..dce49ea55 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 @@ -80,48 +80,305 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -213,46 +470,303 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_multiline_override.rs b/tests/generated/flex/align_baseline_child_multiline_override.rs index d746da7c6..03d0d2a03 100644 --- a/tests/generated/flex/align_baseline_child_multiline_override.rs +++ b/tests/generated/flex/align_baseline_child_multiline_override.rs @@ -81,48 +81,305 @@ fn align_baseline_child_multiline_override__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -215,46 +472,303 @@ fn align_baseline_child_multiline_override__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_padding.rs b/tests/generated/flex/align_baseline_child_padding.rs index 41289e4dd..58c9787b0 100644 --- a/tests/generated/flex/align_baseline_child_padding.rs +++ b/tests/generated/flex/align_baseline_child_padding.rs @@ -64,30 +64,170 @@ fn align_baseline_child_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -160,28 +300,168 @@ fn align_baseline_child_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 110f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_top.rs b/tests/generated/flex/align_baseline_child_top.rs index 4167de4d1..31695b567 100644 --- a/tests/generated/flex/align_baseline_child_top.rs +++ b/tests/generated/flex/align_baseline_child_top.rs @@ -53,30 +53,170 @@ fn align_baseline_child_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -138,28 +278,168 @@ fn align_baseline_child_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_child_top2.rs b/tests/generated/flex/align_baseline_child_top2.rs index 96d9676cf..e50ab03d4 100644 --- a/tests/generated/flex/align_baseline_child_top2.rs +++ b/tests/generated/flex/align_baseline_child_top2.rs @@ -52,30 +52,170 @@ fn align_baseline_child_top2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,28 +276,168 @@ fn align_baseline_child_top2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_column.rs b/tests/generated/flex/align_baseline_column.rs index 2b44f51ef..fa63b806c 100644 --- a/tests/generated/flex/align_baseline_column.rs +++ b/tests/generated/flex/align_baseline_column.rs @@ -40,24 +40,125 @@ fn align_baseline_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -105,22 +206,123 @@ fn align_baseline_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_double_nested_child.rs b/tests/generated/flex/align_baseline_double_nested_child.rs index 7a59a865f..86cebb9a3 100644 --- a/tests/generated/flex/align_baseline_double_nested_child.rs +++ b/tests/generated/flex/align_baseline_double_nested_child.rs @@ -63,36 +63,215 @@ fn align_baseline_double_nested_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -165,34 +344,213 @@ fn align_baseline_double_nested_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_multiline.rs b/tests/generated/flex/align_baseline_multiline.rs index 9486c0eaf..8b9b239f0 100644 --- a/tests/generated/flex/align_baseline_multiline.rs +++ b/tests/generated/flex/align_baseline_multiline.rs @@ -84,48 +84,293 @@ fn align_baseline_multiline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -221,46 +466,291 @@ fn align_baseline_multiline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_multiline_column.rs b/tests/generated/flex/align_baseline_multiline_column.rs index 6fbb45416..d43dd8d82 100644 --- a/tests/generated/flex/align_baseline_multiline_column.rs +++ b/tests/generated/flex/align_baseline_multiline_column.rs @@ -85,48 +85,293 @@ fn align_baseline_multiline_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -223,46 +468,291 @@ fn align_baseline_multiline_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_multiline_column2.rs b/tests/generated/flex/align_baseline_multiline_column2.rs index a79ad8d42..9a191f249 100644 --- a/tests/generated/flex/align_baseline_multiline_column2.rs +++ b/tests/generated/flex/align_baseline_multiline_column2.rs @@ -89,48 +89,293 @@ fn align_baseline_multiline_column2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -231,46 +476,291 @@ fn align_baseline_multiline_column2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 14d3e56b3..992bd7b9a 100644 --- a/tests/generated/flex/align_baseline_multiline_row_and_column.rs +++ b/tests/generated/flex/align_baseline_multiline_row_and_column.rs @@ -84,48 +84,293 @@ fn align_baseline_multiline_row_and_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -221,46 +466,291 @@ fn align_baseline_multiline_row_and_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_nested_child.rs b/tests/generated/flex/align_baseline_nested_child.rs index a2dd67948..3f52da16e 100644 --- a/tests/generated/flex/align_baseline_nested_child.rs +++ b/tests/generated/flex/align_baseline_nested_child.rs @@ -52,30 +52,170 @@ fn align_baseline_nested_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,28 +276,168 @@ fn align_baseline_nested_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_baseline_nested_column.rs b/tests/generated/flex/align_baseline_nested_column.rs index 528a06661..010ede6cd 100644 --- a/tests/generated/flex/align_baseline_nested_column.rs +++ b/tests/generated/flex/align_baseline_nested_column.rs @@ -69,42 +69,260 @@ fn align_baseline_nested_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node10, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node100, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node101, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node101, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node101, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node101, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -187,40 +405,258 @@ fn align_baseline_nested_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node10, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node100, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node101, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node101, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node101, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node101, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 86f432426..12fa18cf2 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 @@ -44,30 +44,176 @@ fn align_center_should_size_based_on_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node000, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,28 +273,174 @@ fn align_center_should_size_based_on_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node000, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_center_single_line.rs b/tests/generated/flex/align_content_center_single_line.rs index 0fdfdc8ff..61bf05fe7 100644 --- a/tests/generated/flex/align_content_center_single_line.rs +++ b/tests/generated/flex/align_content_center_single_line.rs @@ -75,48 +75,281 @@ fn align_content_center_single_line__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node5, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -203,46 +436,279 @@ fn align_content_center_single_line__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node5, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 95f07d548..ed8caccdb 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 @@ -50,24 +50,131 @@ fn align_content_center_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_center_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 da7fa7cee..67ca3aa22 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 @@ -51,24 +51,131 @@ fn align_content_center_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_center_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_center_wrapped.rs b/tests/generated/flex/align_content_center_wrapped.rs index a956446e7..60c2809bf 100644 --- a/tests/generated/flex/align_content_center_wrapped.rs +++ b/tests/generated/flex/align_content_center_wrapped.rs @@ -76,48 +76,281 @@ fn align_content_center_wrapped__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node0, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node4, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node5, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -205,46 +438,279 @@ fn align_content_center_wrapped__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node0, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node1, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node4, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node5, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f436fdb82..7c1dddafa 100644 --- a/tests/generated/flex/align_content_center_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_center_wrapped_negative_space.rs @@ -71,36 +71,221 @@ fn align_content_center_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node00, -25f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node02, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_center_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node00, -25f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node02, 15f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b724454ca..e9fe1c4f9 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 @@ -72,36 +72,221 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 35f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 35f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -35f32, "y of node {:?}. Expected {}. Actual {}", node00, -35f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node02, 25f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 35f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 35f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -35f32, "y of node {:?}. Expected {}. Actual {}", node00, -35f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node02, 25f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_end.rs b/tests/generated/flex/align_content_end.rs index da97fd0ef..2d5a65661 100644 --- a/tests/generated/flex/align_content_end.rs +++ b/tests/generated/flex/align_content_end.rs @@ -68,42 +68,242 @@ fn align_content_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -182,40 +382,240 @@ fn align_content_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c8fce156f..c2a9afba3 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 @@ -50,24 +50,131 @@ fn align_content_end_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_end_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1a6354b2d..126a8b153 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 @@ -51,24 +51,131 @@ fn align_content_end_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_end_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 530a23c38..c895b2d73 100644 --- a/tests/generated/flex/align_content_end_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_end_wrapped_negative_space.rs @@ -71,36 +71,221 @@ fn align_content_end_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node00, -50f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -30f32, "y of node {:?}. Expected {}. Actual {}", node01, -30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_end_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node00, -50f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -30f32, "y of node {:?}. Expected {}. Actual {}", node01, -30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 60633a9ad..352b52bf0 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 @@ -72,36 +72,221 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -70f32, "y of node {:?}. Expected {}. Actual {}", node00, -70f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -40f32, "y of node {:?}. Expected {}. Actual {}", node01, -40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -70f32, "y of node {:?}. Expected {}. Actual {}", node00, -70f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -40f32, "y of node {:?}. Expected {}. Actual {}", node01, -40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_flex_end.rs b/tests/generated/flex/align_content_flex_end.rs index 6148dab06..7f52aeeb9 100644 --- a/tests/generated/flex/align_content_flex_end.rs +++ b/tests/generated/flex/align_content_flex_end.rs @@ -68,42 +68,242 @@ fn align_content_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -182,40 +382,240 @@ fn align_content_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_flex_start.rs b/tests/generated/flex/align_content_flex_start.rs index fab369af9..2361b4cdd 100644 --- a/tests/generated/flex/align_content_flex_start.rs +++ b/tests/generated/flex/align_content_flex_start.rs @@ -67,42 +67,242 @@ fn align_content_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -180,40 +380,240 @@ fn align_content_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 31c595a4a..ecbe663e2 100644 --- a/tests/generated/flex/align_content_flex_start_with_flex.rs +++ b/tests/generated/flex/align_content_flex_start_with_flex.rs @@ -65,42 +65,242 @@ fn align_content_flex_start_with_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node4, 120f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -176,40 +376,240 @@ fn align_content_flex_start_with_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node4, 120f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5fe08925b..e0713e442 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 @@ -59,42 +59,242 @@ fn align_content_flex_start_without_height_on_children__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,40 +364,240 @@ fn align_content_flex_start_without_height_on_children__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 09b055b2b..86fd4d217 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 @@ -52,36 +52,215 @@ fn align_content_not_stretch_with_align_items_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 328f32, "width of node {:?}. Expected {}. Actual {}", node, 328f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 328f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 328f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node0, 272f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node0, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node00, 272f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node00, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 44f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 56f32, "width of node {:?}. Expected {}. Actual {}", node1, 56f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node1, 44f32, size.height); - assert_eq!(location.x, 272f32, "x of node {:?}. Expected {}. Actual {}", node1, 272f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 56f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 272f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 56f32, "width of node {:?}. Expected {}. Actual {}", node10, 56f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node10, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 56f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 44f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,34 +328,213 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 328f32, "width of node {:?}. Expected {}. Actual {}", node, 328f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 328f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 328f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node0, 272f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node0, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node00, 272f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node00, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 44f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 56f32, "width of node {:?}. Expected {}. Actual {}", node1, 56f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node1, 44f32, size.height); - assert_eq!(location.x, 272f32, "x of node {:?}. Expected {}. Actual {}", node1, 272f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 56f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 272f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 56f32, "width of node {:?}. Expected {}. Actual {}", node10, 56f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node10, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 56f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 44f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ae519034b..f3cb52ebc 100644 --- a/tests/generated/flex/align_content_space_around_single_line.rs +++ b/tests/generated/flex/align_content_space_around_single_line.rs @@ -75,48 +75,281 @@ fn align_content_space_around_single_line__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node0, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node1, 16f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 17f32, "x of node {:?}. Expected {}. Actual {}", node1, 17f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 17f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node2, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node2, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node3, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node4, 16f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node4, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node5, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 83f32, "x of node {:?}. Expected {}. Actual {}", node5, 83f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 83f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 83f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -203,46 +436,279 @@ fn align_content_space_around_single_line__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node0, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node1, 16f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 17f32, "x of node {:?}. Expected {}. Actual {}", node1, 17f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 17f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node2, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node2, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node3, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node4, 16f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node4, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node5, 17f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 83f32, "x of node {:?}. Expected {}. Actual {}", node5, 83f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 83f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 83f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 093880705..9a546f0d2 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 @@ -50,24 +50,131 @@ fn align_content_space_around_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_space_around_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 71eb96c4c..61e147936 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 @@ -51,24 +51,131 @@ fn align_content_space_around_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_space_around_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_around_wrapped.rs b/tests/generated/flex/align_content_space_around_wrapped.rs index ba33b241d..2fe9693da 100644 --- a/tests/generated/flex/align_content_space_around_wrapped.rs +++ b/tests/generated/flex/align_content_space_around_wrapped.rs @@ -76,48 +76,281 @@ fn align_content_space_around_wrapped__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node4, 78f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node5, 78f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -205,46 +438,279 @@ fn align_content_space_around_wrapped__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node4, 78f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node5, 78f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 91ff7bad7..c667aaadf 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 @@ -71,36 +71,221 @@ fn align_content_space_around_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_space_around_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 52fe687ed..2b8b4f609 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 @@ -72,36 +72,221 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_around_wrapped_single.rs b/tests/generated/flex/align_content_space_around_wrapped_single.rs index 742a49f55..7d06a1f0b 100644 --- a/tests/generated/flex/align_content_space_around_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_around_wrapped_single.rs @@ -31,18 +31,86 @@ fn align_content_space_around_wrapped_single__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_content_space_around_wrapped_single__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9333efa54..bac532d82 100644 --- a/tests/generated/flex/align_content_space_between_single_line.rs +++ b/tests/generated/flex/align_content_space_between_single_line.rs @@ -75,48 +75,281 @@ fn align_content_space_between_single_line__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -203,46 +436,279 @@ fn align_content_space_between_single_line__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c80920b29..a6fbb3422 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 @@ -50,24 +50,131 @@ fn align_content_space_between_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_space_between_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b411bbb54..950054178 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 @@ -51,24 +51,131 @@ fn align_content_space_between_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_space_between_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_between_wrapped.rs b/tests/generated/flex/align_content_space_between_wrapped.rs index 9882fca89..406403734 100644 --- a/tests/generated/flex/align_content_space_between_wrapped.rs +++ b/tests/generated/flex/align_content_space_between_wrapped.rs @@ -76,48 +76,281 @@ fn align_content_space_between_wrapped__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node5, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -205,46 +438,279 @@ fn align_content_space_between_wrapped__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node5, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2cdd90f80..a654221f9 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 @@ -71,36 +71,221 @@ fn align_content_space_between_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_space_between_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9cca0ec7d..c2453903f 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 @@ -72,36 +72,221 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_between_wrapped_single.rs b/tests/generated/flex/align_content_space_between_wrapped_single.rs index be2096a71..4e8efed05 100644 --- a/tests/generated/flex/align_content_space_between_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_between_wrapped_single.rs @@ -31,18 +31,86 @@ fn align_content_space_between_wrapped_single__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_content_space_between_wrapped_single__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ec807c1d9..69f6eae88 100644 --- a/tests/generated/flex/align_content_space_evenly_single_line.rs +++ b/tests/generated/flex/align_content_space_evenly_single_line.rs @@ -75,48 +75,281 @@ fn align_content_space_evenly_single_line__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -203,46 +436,279 @@ fn align_content_space_evenly_single_line__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d96fe71c8..3bc6f63a1 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 @@ -50,24 +50,131 @@ fn align_content_space_evenly_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_space_evenly_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 79971eed9..7b4dfd514 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 @@ -51,24 +51,131 @@ fn align_content_space_evenly_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_space_evenly_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_evenly_wrapped.rs b/tests/generated/flex/align_content_space_evenly_wrapped.rs index 035880351..315c5bd83 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped.rs @@ -76,48 +76,281 @@ fn align_content_space_evenly_wrapped__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node1, 18f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node4, 73f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node5, 73f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -205,46 +438,279 @@ fn align_content_space_evenly_wrapped__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node1, 18f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node4, 73f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node5, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node5, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node5, 50f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node5, 73f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3a1a5b960..b79b6419b 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 @@ -71,36 +71,221 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 795d57e2d..533624b6f 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 @@ -72,36 +72,221 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_space_evenly_wrapped_single.rs b/tests/generated/flex/align_content_space_evenly_wrapped_single.rs index 7197de41a..70f551ee2 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped_single.rs @@ -31,18 +31,86 @@ fn align_content_space_evenly_wrapped_single__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_content_space_evenly_wrapped_single__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_spacearound.rs b/tests/generated/flex/align_content_spacearound.rs index 99753e65d..9110160af 100644 --- a/tests/generated/flex/align_content_spacearound.rs +++ b/tests/generated/flex/align_content_spacearound.rs @@ -67,42 +67,242 @@ fn align_content_spacearound__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node3, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 95f32, "y of node {:?}. Expected {}. Actual {}", node4, 95f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 95f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -180,40 +380,240 @@ fn align_content_spacearound__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node3, 55f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 95f32, "y of node {:?}. Expected {}. Actual {}", node4, 95f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 95f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_spacebetween.rs b/tests/generated/flex/align_content_spacebetween.rs index d288069b4..7c3cf9fcc 100644 --- a/tests/generated/flex/align_content_spacebetween.rs +++ b/tests/generated/flex/align_content_spacebetween.rs @@ -67,42 +67,242 @@ fn align_content_spacebetween__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -180,40 +380,240 @@ fn align_content_spacebetween__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node2, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node3, 45f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_start.rs b/tests/generated/flex/align_content_start.rs index 8d95f99c3..889fe051c 100644 --- a/tests/generated/flex/align_content_start.rs +++ b/tests/generated/flex/align_content_start.rs @@ -67,42 +67,242 @@ fn align_content_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -180,40 +380,240 @@ fn align_content_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 adbc38e2f..0bf8afe7f 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 @@ -50,24 +50,131 @@ fn align_content_start_single_line_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,22 +232,129 @@ fn align_content_start_single_line_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8d6c00d57..44ea6a0fd 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 @@ -51,24 +51,131 @@ fn align_content_start_single_line_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,22 +234,129 @@ fn align_content_start_single_line_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node00, 60f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3a079bcb9..055b2a057 100644 --- a/tests/generated/flex/align_content_start_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_start_wrapped_negative_space.rs @@ -71,36 +71,221 @@ fn align_content_start_wrapped_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn align_content_start_wrapped_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_stretch.rs b/tests/generated/flex/align_content_stretch.rs index 269dc7415..efe6f44b2 100644 --- a/tests/generated/flex/align_content_stretch.rs +++ b/tests/generated/flex/align_content_stretch.rs @@ -53,42 +53,242 @@ fn align_content_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,40 +352,240 @@ fn align_content_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_stretch_column.rs b/tests/generated/flex/align_content_stretch_column.rs index 8b86af6dd..78dea8845 100644 --- a/tests/generated/flex/align_content_stretch_column.rs +++ b/tests/generated/flex/align_content_stretch_column.rs @@ -68,48 +68,287 @@ fn align_content_stretch_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 150f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node3, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -189,46 +428,285 @@ fn align_content_stretch_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 150f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node3, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d31013949..3440af1a2 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 @@ -38,24 +38,137 @@ fn align_content_stretch_is_not_overriding_align_items__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,22 +217,135 @@ fn align_content_stretch_is_not_overriding_align_items__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_stretch_row.rs b/tests/generated/flex/align_content_stretch_row.rs index 50408da0e..601ebaa6b 100644 --- a/tests/generated/flex/align_content_stretch_row.rs +++ b/tests/generated/flex/align_content_stretch_row.rs @@ -52,42 +52,242 @@ fn align_content_stretch_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -150,40 +350,240 @@ fn align_content_stretch_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 097ebeb89..e56863367 100644 --- a/tests/generated/flex/align_content_stretch_row_with_children.rs +++ b/tests/generated/flex/align_content_stretch_row_with_children.rs @@ -64,48 +64,287 @@ fn align_content_stretch_row_with_children__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,46 +420,285 @@ fn align_content_stretch_row_with_children__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bf5c96727..b6e401157 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 @@ -55,42 +55,242 @@ fn align_content_stretch_row_with_fixed_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node2, 80f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -156,40 +356,240 @@ fn align_content_stretch_row_with_fixed_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node2, 80f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bfdfe44e5..f5c07fe3e 100644 --- a/tests/generated/flex/align_content_stretch_row_with_flex.rs +++ b/tests/generated/flex/align_content_stretch_row_with_flex.rs @@ -58,42 +58,272 @@ fn align_content_stretch_row_with_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node3, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,40 +392,270 @@ fn align_content_stretch_row_with_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node3, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3eed6ac30..36ccb1c90 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 @@ -58,42 +58,272 @@ fn align_content_stretch_row_with_flex_no_shrink__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node3, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,40 +392,270 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node3, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5455979e9..011178e83 100644 --- a/tests/generated/flex/align_content_stretch_row_with_margin.rs +++ b/tests/generated/flex/align_content_stretch_row_with_margin.rs @@ -64,42 +64,242 @@ fn align_content_stretch_row_with_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn align_content_stretch_row_with_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 751ef0e36..37e480943 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 @@ -53,42 +53,242 @@ fn align_content_stretch_row_with_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,40 +352,240 @@ fn align_content_stretch_row_with_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6f96cb710..bd4414fd1 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 @@ -53,42 +53,242 @@ fn align_content_stretch_row_with_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node2, 90f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,40 +352,240 @@ fn align_content_stretch_row_with_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node2, 90f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node4, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f6c6d7c45..6ed66feb5 100644 --- a/tests/generated/flex/align_content_stretch_row_with_padding.rs +++ b/tests/generated/flex/align_content_stretch_row_with_padding.rs @@ -64,42 +64,242 @@ fn align_content_stretch_row_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn align_content_stretch_row_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node1, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node3, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node4, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 13204cf34..3fa497905 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 @@ -34,24 +34,137 @@ fn align_content_stretch_row_with_single_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,22 +206,135 @@ fn align_content_stretch_row_with_single_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_content_stretch_row_wrap.rs b/tests/generated/flex/align_content_stretch_row_wrap.rs index 24085f0ae..c5f7cf76e 100644 --- a/tests/generated/flex/align_content_stretch_row_wrap.rs +++ b/tests/generated/flex/align_content_stretch_row_wrap.rs @@ -40,24 +40,137 @@ fn align_content_stretch_row_wrap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node0, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node00, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -105,22 +218,135 @@ fn align_content_stretch_row_wrap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node0, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node00, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4b8485186..d566d1583 100644 --- a/tests/generated/flex/align_flex_start_with_shrinking_children.rs +++ b/tests/generated/flex/align_flex_start_with_shrinking_children.rs @@ -31,30 +31,176 @@ fn align_flex_start_with_shrinking_children__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,28 +255,174 @@ fn align_flex_start_with_shrinking_children__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 816fccbf3..b6612b717 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 @@ -39,30 +39,176 @@ fn align_flex_start_with_shrinking_children_with_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +264,174 @@ fn align_flex_start_with_shrinking_children_with_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 26a533fb5..b8611144d 100644 --- a/tests/generated/flex/align_flex_start_with_stretching_children.rs +++ b/tests/generated/flex/align_flex_start_with_stretching_children.rs @@ -31,30 +31,182 @@ fn align_flex_start_with_stretching_children__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node00, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node000, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,28 +261,180 @@ fn align_flex_start_with_stretching_children__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node00, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node000, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center.rs b/tests/generated/flex/align_items_center.rs index ef2c7528b..9ef044414 100644 --- a/tests/generated/flex/align_items_center.rs +++ b/tests/generated/flex/align_items_center.rs @@ -30,18 +30,86 @@ fn align_items_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_items_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 700d54ea4..1a4126149 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 @@ -38,24 +38,131 @@ fn align_items_center_child_with_margin_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,22 +211,129 @@ fn align_items_center_child_with_margin_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ec673c7c7..cc02a9637 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 @@ -37,24 +37,131 @@ fn align_items_center_child_without_margin_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node0, 70f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node00, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 70f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -102,22 +209,129 @@ fn align_items_center_child_without_margin_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node0, 70f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node00, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 70f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 40ec5d62d..b292b0c75 100644 --- a/tests/generated/flex/align_items_center_justify_content_center.rs +++ b/tests/generated/flex/align_items_center_justify_content_center.rs @@ -63,30 +63,176 @@ fn align_items_center_justify_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node0, 500f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 245f32, "x of node {:?}. Expected {}. Actual {}", node00, 245f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 245f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 245f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node000, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node000, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -158,28 +304,174 @@ fn align_items_center_justify_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node0, 500f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 245f32, "x of node {:?}. Expected {}. Actual {}", node00, 245f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 245f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 245f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node000, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node000, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e33f72e21..384139a78 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 @@ -35,18 +35,86 @@ fn align_items_center_min_max_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 78f32, "height of node {:?}. Expected {}. Actual {}", node, 78f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 78f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node0, 62f32, size.width); - assert_eq!(size.height, 62f32, "height of node {:?}. Expected {}. Actual {}", node0, 62f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 62f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn align_items_center_min_max_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 88f32, "height of node {:?}. Expected {}. Actual {}", node, 88f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 88f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node0, 62f32, size.width); - assert_eq!(size.height, 62f32, "height of node {:?}. Expected {}. Actual {}", node0, 62f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node0, 13f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 62f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 65ed8f5c4..8b6987a7b 100644 --- a/tests/generated/flex/align_items_center_with_child_margin.rs +++ b/tests/generated/flex/align_items_center_with_child_margin.rs @@ -31,18 +31,86 @@ fn align_items_center_with_child_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_items_center_with_child_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c4fa378e0..b2a674b39 100644 --- a/tests/generated/flex/align_items_center_with_child_top.rs +++ b/tests/generated/flex/align_items_center_with_child_top.rs @@ -31,18 +31,86 @@ fn align_items_center_with_child_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node0, 55f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_items_center_with_child_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node0, 55f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs b/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs index f6aae6368..1e47da6b8 100644 --- a/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs +++ b/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs @@ -76,48 +76,317 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node10, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node11, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -209,46 +478,315 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node10, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node11, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs index 0b7acbe17..6938f8f64 100644 --- a/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs @@ -57,30 +57,176 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node01, 15f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,28 +292,174 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node01, 15f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs index 61d5d9ea8..aad8d2531 100644 --- a/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs @@ -38,24 +38,131 @@ fn align_items_center_with_max_height_with_align_content_flex_start__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node0, 25f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node1, -25f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +208,129 @@ fn align_items_center_with_max_height_with_align_content_flex_start__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node0, 25f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node1, -25f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs b/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs index 5021dd546..a40e59dc0 100644 --- a/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs +++ b/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs @@ -101,48 +101,317 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 35f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 35f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node01, 150f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node01, -25f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 80f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node10, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node11, 150f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node11, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -258,46 +527,315 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 280f32, "height of node {:?}. Expected {}. Actual {}", node, 280f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 280f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 280f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 30f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node00, 65f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node01, 150f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node1, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node1, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node1, 140f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node10, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node11, 150f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node11, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs index 2c8856d9c..8f48d3fc6 100644 --- a/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs @@ -51,30 +51,182 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node01, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +286,180 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node01, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs index 0e629fd1e..80b7f1136 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs @@ -38,24 +38,125 @@ fn align_items_center_with_min_height_with_align_content_flex_start__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn align_items_center_with_min_height_with_align_content_flex_start__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs index f1269b748..7fca1296d 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs @@ -134,84 +134,587 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node10, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node11, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node2, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node20, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node21, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node21, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node21, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node21, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node3, 300f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node30).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node30, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node30, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node30, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node30, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node31).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node31, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node31, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node31, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node31, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -366,82 +869,585 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node10, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node11, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node2, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node20, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node21, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node21, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node21, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node21, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node3, 300f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node30).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node30, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node30, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node30, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node30, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node31).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node31, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node31, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node31, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node31, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs b/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs index d6fb81b33..f7c9346a9 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs @@ -96,48 +96,317 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node00, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node01, 25f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node01, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node10, 15f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node11, 15f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -249,46 +518,315 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 260f32, "width of node {:?}. Expected {}. Actual {}", node, 260f32, size.width); - assert_eq!(size.height, 130f32, "height of node {:?}. Expected {}. Actual {}", node, 130f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 260f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 260f32, layout.size.width); + } + if layout.size.height != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 130f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node0, 130f32, size.width); - assert_eq!(size.height, 130f32, "height of node {:?}. Expected {}. Actual {}", node0, 130f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 130f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 130f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node00, 15f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node00, 60f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node01, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node01, 25f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node01, 55f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node1, 130f32, size.width); - assert_eq!(size.height, 130f32, "height of node {:?}. Expected {}. Actual {}", node1, 130f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node1, 130f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 130f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 130f32, + layout.size.height + ); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node10, 15f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node11, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node11, 15f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_flex_end.rs b/tests/generated/flex/align_items_flex_end.rs index 759f295f1..5a9c18469 100644 --- a/tests/generated/flex/align_items_flex_end.rs +++ b/tests/generated/flex/align_items_flex_end.rs @@ -30,18 +30,86 @@ fn align_items_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_items_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1586435e1..57756a0c6 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 @@ -38,24 +38,131 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,22 +211,129 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d67de9206..7e17215bf 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 @@ -37,24 +37,131 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node0, 70f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node00, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 70f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -102,22 +209,129 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node0, 70f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node0, -10f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node0, -10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node00, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 70f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_flex_start.rs b/tests/generated/flex/align_items_flex_start.rs index 7a15c2fb7..d32f071b3 100644 --- a/tests/generated/flex/align_items_flex_start.rs +++ b/tests/generated/flex/align_items_flex_start.rs @@ -30,18 +30,86 @@ fn align_items_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_items_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_min_max.rs b/tests/generated/flex/align_items_min_max.rs index 33b0dac35..15e0d875c 100644 --- a/tests/generated/flex/align_items_min_max.rs +++ b/tests/generated/flex/align_items_min_max.rs @@ -30,18 +30,86 @@ fn align_items_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_items_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_stretch.rs b/tests/generated/flex/align_items_stretch.rs index 6f273217c..eb7b5beac 100644 --- a/tests/generated/flex/align_items_stretch.rs +++ b/tests/generated/flex/align_items_stretch.rs @@ -26,18 +26,92 @@ fn align_items_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -70,16 +144,90 @@ fn align_items_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_items_stretch_min_cross.rs b/tests/generated/flex/align_items_stretch_min_cross.rs index c20887469..cf170dfd7 100644 --- a/tests/generated/flex/align_items_stretch_min_cross.rs +++ b/tests/generated/flex/align_items_stretch_min_cross.rs @@ -28,18 +28,86 @@ fn align_items_stretch_min_cross__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node0, 400f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node0, 36f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn align_items_stretch_min_cross__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node0, 400f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node0, 36f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_self_baseline.rs b/tests/generated/flex/align_self_baseline.rs index e7365e272..c2f25a1ef 100644 --- a/tests/generated/flex/align_self_baseline.rs +++ b/tests/generated/flex/align_self_baseline.rs @@ -52,30 +52,170 @@ fn align_self_baseline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -136,28 +276,168 @@ fn align_self_baseline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_self_center.rs b/tests/generated/flex/align_self_center.rs index 357446266..749d92c4b 100644 --- a/tests/generated/flex/align_self_center.rs +++ b/tests/generated/flex/align_self_center.rs @@ -30,18 +30,86 @@ fn align_self_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_self_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node0, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 19da963d6..9d5423d47 100644 --- a/tests/generated/flex/align_self_center_undefined_max_height.rs +++ b/tests/generated/flex/align_self_center_undefined_max_height.rs @@ -37,24 +37,125 @@ fn align_self_center_undefined_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 280f32, "width of node {:?}. Expected {}. Actual {}", node, 280f32, size.width); - assert_eq!(size.height, 56f32, "height of node {:?}. Expected {}. Actual {}", node, 56f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 280f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 280f32, layout.size.width); + } + if layout.size.height != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 56f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node0, 240f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node0, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 56f32, "height of node {:?}. Expected {}. Actual {}", node1, 56f32, size.height); - assert_eq!(location.x, 240f32, "x of node {:?}. Expected {}. Actual {}", node1, 240f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 56f32, layout.size.height); + } + if layout.location.x != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 240f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +200,123 @@ fn align_self_center_undefined_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 280f32, "width of node {:?}. Expected {}. Actual {}", node, 280f32, size.width); - assert_eq!(size.height, 56f32, "height of node {:?}. Expected {}. Actual {}", node, 56f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 280f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 280f32, layout.size.width); + } + if layout.size.height != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 56f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node0, 240f32, size.width); - assert_eq!(size.height, 44f32, "height of node {:?}. Expected {}. Actual {}", node0, 44f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 44f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 56f32, "height of node {:?}. Expected {}. Actual {}", node1, 56f32, size.height); - assert_eq!(location.x, 240f32, "x of node {:?}. Expected {}. Actual {}", node1, 240f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 56f32, layout.size.height); + } + if layout.location.x != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 240f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_self_flex_end.rs b/tests/generated/flex/align_self_flex_end.rs index 109787b4a..64f28f54c 100644 --- a/tests/generated/flex/align_self_flex_end.rs +++ b/tests/generated/flex/align_self_flex_end.rs @@ -30,18 +30,86 @@ fn align_self_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_self_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 72648384e..285b725d9 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 @@ -31,18 +31,86 @@ fn align_self_flex_end_override_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn align_self_flex_end_override_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/align_self_flex_start.rs b/tests/generated/flex/align_self_flex_start.rs index 04a865c37..1013e74ae 100644 --- a/tests/generated/flex/align_self_flex_start.rs +++ b/tests/generated/flex/align_self_flex_start.rs @@ -30,18 +30,86 @@ fn align_self_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn align_self_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 20d8a28ab..85f5b2e82 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 @@ -43,30 +43,182 @@ fn align_stretch_should_size_based_on_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node000, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,28 +277,180 @@ fn align_stretch_should_size_based_on_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node000, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/android_news_feed.rs b/tests/generated/flex/android_news_feed.rs index 29ec8e9f7..9afb9937c 100644 --- a/tests/generated/flex/android_news_feed.rs +++ b/tests/generated/flex/android_news_feed.rs @@ -198,108 +198,1007 @@ fn android_news_feed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node0, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node00, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node00, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node000, 1080f32, size.width); - assert_eq!(size.height, 144f32, "height of node {:?}. Expected {}. Actual {}", node000, 144f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 144f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 144f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1044f32, "width of node {:?}. Expected {}. Actual {}", node0000, 1044f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0000, 120f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node0000, 36f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node0000, 24f32, location.y); + if layout.size.width != 1044f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 1044f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(location.y), + 24f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node00000, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node00000, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00000, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(size.width), + 120f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node000000, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node000000, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000000, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(size.width), + 120f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00001, 72f32, size.width); - assert_eq!(size.height, 39f32, "height of node {:?}. Expected {}. Actual {}", node00001, 39f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node00001, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00001, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 39f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(size.height), + 39f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(location.x), + 120f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000010, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000010, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node000010, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node000010, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000011, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000011, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node000011, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node000011, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node001, 1080f32, size.width); - assert_eq!(size.height, 96f32, "height of node {:?}. Expected {}. Actual {}", node001, 96f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node001, 0f32, location.x); - assert_eq!(location.y, 144f32, "y of node {:?}. Expected {}. Actual {}", node001, 144f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 96f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 96f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 144f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(location.y), + 144f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 906f32, "width of node {:?}. Expected {}. Actual {}", node0010, 906f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0010, 72f32, size.height); - assert_eq!(location.x, 174f32, "x of node {:?}. Expected {}. Actual {}", node0010, 174f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node0010, 24f32, location.y); + if layout.size.width != 906f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.width), + 906f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 174f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(location.x), + 174f32, + layout.location.x + ); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(location.y), + 24f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00100, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node00100, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node001000, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node001000, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node001000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001000, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00101, 72f32, size.width); - assert_eq!(size.height, 39f32, "height of node {:?}. Expected {}. Actual {}", node00101, 39f32, size.height); - assert_eq!(location.x, 72f32, "x of node {:?}. Expected {}. Actual {}", node00101, 72f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00101, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 39f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.height), + 39f32, + layout.size.height + ); + } + if layout.location.x != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.x), + 72f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node001010, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node001010, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node001010, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node001010, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node001011, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node001011, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node001011, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node001011, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -519,106 +1418,1005 @@ fn android_news_feed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node0, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node00, 1080f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node00, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node000, 1080f32, size.width); - assert_eq!(size.height, 144f32, "height of node {:?}. Expected {}. Actual {}", node000, 144f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 144f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 144f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1044f32, "width of node {:?}. Expected {}. Actual {}", node0000, 1044f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0000, 120f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node0000, 36f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node0000, 24f32, location.y); + if layout.size.width != 1044f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.width), + 1044f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(location.y), + 24f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node00000, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node00000, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00000, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(size.width), + 120f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node000000, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node000000, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000000, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(size.width), + 120f32, + layout.size.width + ); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00001, 72f32, size.width); - assert_eq!(size.height, 39f32, "height of node {:?}. Expected {}. Actual {}", node00001, 39f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node00001, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00001, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 39f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(size.height), + 39f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(location.x), + 120f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000010, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000010, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node000010, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node000010, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000011, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000011, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node000011, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node000011, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node001, 1080f32, size.width); - assert_eq!(size.height, 96f32, "height of node {:?}. Expected {}. Actual {}", node001, 96f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node001, 0f32, location.x); - assert_eq!(location.y, 144f32, "y of node {:?}. Expected {}. Actual {}", node001, 144f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.width), + 1080f32, + layout.size.width + ); + } + if layout.size.height != 96f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 96f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 144f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(location.y), + 144f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 906f32, "width of node {:?}. Expected {}. Actual {}", node0010, 906f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0010, 72f32, size.height); - assert_eq!(location.x, 174f32, "x of node {:?}. Expected {}. Actual {}", node0010, 174f32, location.x); - assert_eq!(location.y, 24f32, "y of node {:?}. Expected {}. Actual {}", node0010, 24f32, location.y); + if layout.size.width != 906f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.width), + 906f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 174f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(location.x), + 174f32, + layout.location.x + ); + } + if layout.location.y != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(location.y), + 24f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00100, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node00100, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node001000, 72f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node001000, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node001000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001000, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(size.height), + 72f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node00101, 72f32, size.width); - assert_eq!(size.height, 39f32, "height of node {:?}. Expected {}. Actual {}", node00101, 39f32, size.height); - assert_eq!(location.x, 72f32, "x of node {:?}. Expected {}. Actual {}", node00101, 72f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00101, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.width), + 72f32, + layout.size.width + ); + } + if layout.size.height != 39f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.height), + 39f32, + layout.size.height + ); + } + if layout.location.x != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.x), + 72f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node001010, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node001010, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node001010, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node001010, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node001011, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node001011, 0f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node001011, 36f32, location.x); - assert_eq!(location.y, 21f32, "y of node {:?}. Expected {}. Actual {}", node001011, 21f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(size.width), + 0f32, + layout.size.width + ); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(location.x), + 36f32, + layout.location.x + ); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(location.y), + 21f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fbd4af51c..7d113b3c4 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs @@ -30,18 +30,86 @@ fn aspect_ratio_flex_column_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn aspect_ratio_flex_column_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6bbf075ce..7750c6645 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 @@ -4,7 +4,18 @@ fn aspect_ratio_flex_column_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -24,18 +35,86 @@ fn aspect_ratio_flex_column_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -44,7 +123,19 @@ fn aspect_ratio_flex_column_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -65,16 +156,84 @@ fn aspect_ratio_flex_column_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 69c8219b3..2b52bfcd5 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 @@ -33,18 +33,86 @@ fn aspect_ratio_flex_column_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn aspect_ratio_flex_column_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1eb59377a..a85abe4bb 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 @@ -30,18 +30,86 @@ fn aspect_ratio_flex_column_fill_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn aspect_ratio_flex_column_fill_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8b32b4af3..606f0feeb 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 @@ -33,18 +33,86 @@ fn aspect_ratio_flex_column_fill_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn aspect_ratio_flex_column_fill_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6c0ed5ef8..fe3783afb 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs @@ -30,18 +30,86 @@ fn aspect_ratio_flex_column_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn aspect_ratio_flex_column_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 85bc74e8d..139c3ca1d 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 @@ -29,18 +29,86 @@ fn aspect_ratio_flex_column_fill_width_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_column_fill_width_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b51b1083e..2f4def816 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 @@ -29,18 +29,86 @@ fn aspect_ratio_flex_column_stretch_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_column_stretch_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 aaf8d738a..6b0df775f 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 @@ -4,7 +4,18 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -23,18 +34,86 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -43,7 +122,19 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -63,16 +154,84 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cbc59d47d..d6060fb22 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 @@ -32,18 +32,86 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5d617888d..2e2ae8bdc 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 @@ -29,18 +29,86 @@ fn aspect_ratio_flex_column_stretch_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_column_stretch_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8e518a1a4..2b5743911 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs @@ -29,18 +29,86 @@ fn aspect_ratio_flex_row_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_row_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0d390d579..9e4ec7b97 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 @@ -4,7 +4,18 @@ fn aspect_ratio_flex_row_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -23,18 +34,86 @@ fn aspect_ratio_flex_row_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -43,7 +122,19 @@ fn aspect_ratio_flex_row_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -63,16 +154,84 @@ fn aspect_ratio_flex_row_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 10c2271e7..f878fe0ec 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 @@ -32,18 +32,86 @@ fn aspect_ratio_flex_row_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn aspect_ratio_flex_row_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 306fd109e..593940d46 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 @@ -29,18 +29,86 @@ fn aspect_ratio_flex_row_fill_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_row_fill_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 120c99d6c..576930265 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 @@ -32,18 +32,86 @@ fn aspect_ratio_flex_row_fill_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn aspect_ratio_flex_row_fill_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5ad0e7b6c..e3678a1df 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs @@ -29,18 +29,86 @@ fn aspect_ratio_flex_row_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_row_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 95b9f96c9..6345902bd 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 @@ -29,18 +29,86 @@ fn aspect_ratio_flex_row_fill_width_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn aspect_ratio_flex_row_fill_width_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ee5f21bc2..69f9c316a 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 @@ -28,18 +28,92 @@ fn aspect_ratio_flex_row_stretch_fill_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +148,90 @@ fn aspect_ratio_flex_row_stretch_fill_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f817b405c..c1d32fab6 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 @@ -4,7 +4,18 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -22,18 +33,92 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -42,7 +127,19 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , max_size : taffy :: geometry :: Size { width : taffy :: style :: Dimension :: from_length (40f32) , height : auto () , } , aspect_ratio : Some (2f32) , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = + "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"; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, + aspect_ratio: Some(2f32), + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -61,16 +158,90 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f13106260..14d0c6225 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 @@ -31,18 +31,86 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 849bd3482..fc0a50120 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 @@ -28,18 +28,86 @@ fn aspect_ratio_flex_row_stretch_fill_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn aspect_ratio_flex_row_stretch_fill_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_10343_block.rs b/tests/generated/flex/bevy_issue_10343_block.rs index b4b46d9a1..e87685105 100644 --- a/tests/generated/flex/bevy_issue_10343_block.rs +++ b/tests/generated/flex/bevy_issue_10343_block.rs @@ -49,30 +49,182 @@ fn bevy_issue_10343_block__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node000, 90f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +286,180 @@ fn bevy_issue_10343_block__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node000, 90f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node000, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 0f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_10343_flex.rs b/tests/generated/flex/bevy_issue_10343_flex.rs index b65aa9208..a2d007a2e 100644 --- a/tests/generated/flex/bevy_issue_10343_flex.rs +++ b/tests/generated/flex/bevy_issue_10343_flex.rs @@ -49,30 +49,182 @@ fn bevy_issue_10343_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node000, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +286,180 @@ fn bevy_issue_10343_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node000, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_10343_grid.rs b/tests/generated/flex/bevy_issue_10343_grid.rs index bd25700ff..8760e16b4 100644 --- a/tests/generated/flex/bevy_issue_10343_grid.rs +++ b/tests/generated/flex/bevy_issue_10343_grid.rs @@ -49,30 +49,182 @@ fn bevy_issue_10343_grid__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node000, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node000, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +286,180 @@ fn bevy_issue_10343_grid__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 110f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 110f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node00, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node000, 90f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node000, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_16304.rs b/tests/generated/flex/bevy_issue_16304.rs index 6fbf53dbb..d5628e28c 100644 --- a/tests/generated/flex/bevy_issue_16304.rs +++ b/tests/generated/flex/bevy_issue_16304.rs @@ -52,36 +52,221 @@ fn bevy_issue_16304__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node001, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node001, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node001, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,34 +334,219 @@ fn bevy_issue_16304__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node001, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node001, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node001, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_21240.rs b/tests/generated/flex/bevy_issue_21240.rs index 9f160c193..405a87e58 100644 --- a/tests/generated/flex/bevy_issue_21240.rs +++ b/tests/generated/flex/bevy_issue_21240.rs @@ -42,48 +42,281 @@ fn bevy_issue_21240__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 152f32, "height of node {:?}. Expected {}. Actual {}", node, 152f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 152f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 56f32, "x of node {:?}. Expected {}. Actual {}", node1, 56f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node1, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 56f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 104f32, "x of node {:?}. Expected {}. Actual {}", node2, 104f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node2, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 104f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 104f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 152f32, "x of node {:?}. Expected {}. Actual {}", node3, 152f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node3, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 152f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node4, 184f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node4, 8f32, location.x); - assert_eq!(location.y, 56f32, "y of node {:?}. Expected {}. Actual {}", node4, 56f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 56f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node5, 184f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node5, 8f32, location.x); - assert_eq!(location.y, 104f32, "y of node {:?}. Expected {}. Actual {}", node5, 104f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 104f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 104f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,46 +374,279 @@ fn bevy_issue_21240__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 152f32, "height of node {:?}. Expected {}. Actual {}", node, 152f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 152f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 56f32, "x of node {:?}. Expected {}. Actual {}", node1, 56f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node1, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 56f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 104f32, "x of node {:?}. Expected {}. Actual {}", node2, 104f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node2, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 104f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 104f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 152f32, "x of node {:?}. Expected {}. Actual {}", node3, 152f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node3, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 152f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node4, 184f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node4, 8f32, location.x); - assert_eq!(location.y, 56f32, "y of node {:?}. Expected {}. Actual {}", node4, 56f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 56f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node5, 184f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node5, 8f32, location.x); - assert_eq!(location.y, 104f32, "y of node {:?}. Expected {}. Actual {}", node5, 104f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 104f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 104f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_7976_3_level.rs b/tests/generated/flex/bevy_issue_7976_3_level.rs index bdec628e9..2f98d1d37 100644 --- a/tests/generated/flex/bevy_issue_7976_3_level.rs +++ b/tests/generated/flex/bevy_issue_7976_3_level.rs @@ -60,24 +60,137 @@ fn bevy_issue_7976_3_level__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node0, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node00, 180f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -145,22 +258,135 @@ fn bevy_issue_7976_3_level__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node0, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node00, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_7976_4_level.rs b/tests/generated/flex/bevy_issue_7976_4_level.rs index f9e8b3433..1d3feac88 100644 --- a/tests/generated/flex/bevy_issue_7976_4_level.rs +++ b/tests/generated/flex/bevy_issue_7976_4_level.rs @@ -64,30 +64,182 @@ fn bevy_issue_7976_4_level__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node0, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node00, 180f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 170f32, "height of node {:?}. Expected {}. Actual {}", node000, 170f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node000, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node000, 5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 170f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 170f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -161,28 +313,180 @@ fn bevy_issue_7976_4_level__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node0, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 190f32, "height of node {:?}. Expected {}. Actual {}", node00, 190f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 190f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 190f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node000, 0f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node000, 180f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node000, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node000, 5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_7976_reduced.rs b/tests/generated/flex/bevy_issue_7976_reduced.rs index 00857444b..9216f4508 100644 --- a/tests/generated/flex/bevy_issue_7976_reduced.rs +++ b/tests/generated/flex/bevy_issue_7976_reduced.rs @@ -24,18 +24,92 @@ fn bevy_issue_7976_reduced__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -66,16 +140,90 @@ fn bevy_issue_7976_reduced__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_8017.rs b/tests/generated/flex/bevy_issue_8017.rs index 3e6967785..2b9e66ef6 100644 --- a/tests/generated/flex/bevy_issue_8017.rs +++ b/tests/generated/flex/bevy_issue_8017.rs @@ -93,48 +93,317 @@ fn bevy_issue_8017__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 384f32, "width of node {:?}. Expected {}. Actual {}", node0, 384f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node0, 188f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 384f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 384f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 188f32, "width of node {:?}. Expected {}. Actual {}", node00, 188f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node00, 188f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 188f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 188f32, "width of node {:?}. Expected {}. Actual {}", node01, 188f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node01, 188f32, size.height); - assert_eq!(location.x, 196f32, "x of node {:?}. Expected {}. Actual {}", node01, 196f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 188f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 196f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 384f32, "width of node {:?}. Expected {}. Actual {}", node1, 384f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node1, 188f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 204f32, "y of node {:?}. Expected {}. Actual {}", node1, 204f32, location.y); + if layout.size.width != 384f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 384f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 204f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 204f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 188f32, "width of node {:?}. Expected {}. Actual {}", node10, 188f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node10, 188f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 188f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 188f32, "width of node {:?}. Expected {}. Actual {}", node11, 188f32, size.width); - assert_eq!(size.height, 188f32, "height of node {:?}. Expected {}. Actual {}", node11, 188f32, size.height); - assert_eq!(location.x, 196f32, "x of node {:?}. Expected {}. Actual {}", node11, 196f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 188f32, layout.size.width); + } + if layout.size.height != 188f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 188f32, + layout.size.height + ); + } + if layout.location.x != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 196f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -239,46 +508,315 @@ fn bevy_issue_8017__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 416f32, "width of node {:?}. Expected {}. Actual {}", node, 416f32, size.width); - assert_eq!(size.height, 416f32, "height of node {:?}. Expected {}. Actual {}", node, 416f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 416f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 416f32, layout.size.width); + } + if layout.size.height != 416f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 416f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node0, 400f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node0, 196f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 196f32, "width of node {:?}. Expected {}. Actual {}", node00, 196f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node00, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 196f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 196f32, "width of node {:?}. Expected {}. Actual {}", node01, 196f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node01, 196f32, size.height); - assert_eq!(location.x, 204f32, "x of node {:?}. Expected {}. Actual {}", node01, 204f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 196f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 204f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 204f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node1, 400f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node1, 196f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node1, 8f32, location.x); - assert_eq!(location.y, 212f32, "y of node {:?}. Expected {}. Actual {}", node1, 212f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 212f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 212f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 196f32, "width of node {:?}. Expected {}. Actual {}", node10, 196f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node10, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 196f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 196f32, "width of node {:?}. Expected {}. Actual {}", node11, 196f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node11, 196f32, size.height); - assert_eq!(location.x, 204f32, "x of node {:?}. Expected {}. Actual {}", node11, 204f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 196f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 196f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 204f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 204f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_8017_reduced.rs b/tests/generated/flex/bevy_issue_8017_reduced.rs index 0d52bcbff..f1d90be0e 100644 --- a/tests/generated/flex/bevy_issue_8017_reduced.rs +++ b/tests/generated/flex/bevy_issue_8017_reduced.rs @@ -42,36 +42,227 @@ fn bevy_issue_8017_reduced__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node0, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node00, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node1, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 204f32, "y of node {:?}. Expected {}. Actual {}", node1, 204f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 204f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 204f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node10, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,34 +316,225 @@ fn bevy_issue_8017_reduced__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node0, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node00, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node1, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 204f32, "y of node {:?}. Expected {}. Actual {}", node1, 204f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 204f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 204f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 196f32, "height of node {:?}. Expected {}. Actual {}", node10, 196f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 196f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 196f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_8082.rs b/tests/generated/flex/bevy_issue_8082.rs index 6ef23e9cc..1ad879ad3 100644 --- a/tests/generated/flex/bevy_issue_8082.rs +++ b/tests/generated/flex/bevy_issue_8082.rs @@ -96,42 +96,272 @@ fn bevy_issue_8082__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node00, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node01, 110f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node02, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node02, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node02, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node03, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node03, 50f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node03, 110f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node03, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -238,40 +468,270 @@ fn bevy_issue_8082__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node00, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node01, 110f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node02, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node02, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node02, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node03, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node03, 50f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node03, 110f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node03, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_8082_percent.rs b/tests/generated/flex/bevy_issue_8082_percent.rs index 8ad6605fc..a6528c28d 100644 --- a/tests/generated/flex/bevy_issue_8082_percent.rs +++ b/tests/generated/flex/bevy_issue_8082_percent.rs @@ -73,42 +73,272 @@ fn bevy_issue_8082_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node02, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node02, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node03, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node03, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node03, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -192,40 +422,270 @@ fn bevy_issue_8082_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node02, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node02, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node02, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node03, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node03, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node03, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_9530.rs b/tests/generated/flex/bevy_issue_9530.rs index b2f0aedee..b4ccff40a 100644 --- a/tests/generated/flex/bevy_issue_9530.rs +++ b/tests/generated/flex/bevy_issue_9530.rs @@ -23,7 +23,25 @@ fn bevy_issue_9530__border_box() { ..Default::default() }) .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 : length (20f32) , right : length (20f32) , top : length (20f32) , bottom : length (20f32) , } , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node11_text = "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" ; + 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: length(20f32), + right: length(20f32), + top: length(20f32), + bottom: length(20f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node11_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { size: taffy::geometry::Size { @@ -81,42 +99,266 @@ fn bevy_issue_9530__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 140f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node1, 300f32, size.width); - assert_eq!(size.height, 420f32, "height of node {:?}. Expected {}. Actual {}", node1, 420f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 420f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 420f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 260f32, "width of node {:?}. Expected {}. Actual {}", node10, 260f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node10, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 260f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 260f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 220f32, "width of node {:?}. Expected {}. Actual {}", node11, 220f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node11, 240f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node11, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node11, 90f32, location.y); + if layout.size.width != 220f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 220f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 260f32, "width of node {:?}. Expected {}. Actual {}", node12, 260f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node12, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node12, 20f32, location.x); - assert_eq!(location.y, 350f32, "y of node {:?}. Expected {}. Actual {}", node12, 350f32, location.y); + if layout.size.width != 260f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 260f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 350f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 350f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,7 +388,26 @@ fn bevy_issue_9530__content_box() { ..Default::default() }) .unwrap(); - let node11 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , 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 : length (20f32) , right : length (20f32) , top : length (20f32) , bottom : length (20f32) , } , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node11_text = "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" ; + let node11 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + 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: length(20f32), + right: length(20f32), + top: length(20f32), + bottom: length(20f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node11_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, @@ -207,40 +468,264 @@ fn bevy_issue_9530__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 340f32, "width of node {:?}. Expected {}. Actual {}", node1, 340f32, size.width); - assert_eq!(size.height, 380f32, "height of node {:?}. Expected {}. Actual {}", node1, 380f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node1, -20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 340f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 340f32, layout.size.width); + } + if layout.size.height != 380f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 380f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node10, 300f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node10, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 260f32, "width of node {:?}. Expected {}. Actual {}", node11, 260f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node11, 200f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node11, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node11, 90f32, location.y); + if layout.size.width != 260f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 260f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node12, 300f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node12, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node12, 20f32, location.x); - assert_eq!(location.y, 310f32, "y of node {:?}. Expected {}. Actual {}", node12, 310f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 310f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 310f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_9530_reduced.rs b/tests/generated/flex/bevy_issue_9530_reduced.rs index eaa24b427..de9f85915 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced.rs @@ -34,24 +34,131 @@ fn bevy_issue_9530_reduced__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,22 +203,129 @@ fn bevy_issue_9530_reduced__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_9530_reduced2.rs b/tests/generated/flex/bevy_issue_9530_reduced2.rs index e314c8994..ce2b9395c 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced2.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced2.rs @@ -40,24 +40,131 @@ fn bevy_issue_9530_reduced2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node00, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -111,22 +218,129 @@ fn bevy_issue_9530_reduced2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node00, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_9530_reduced3.rs b/tests/generated/flex/bevy_issue_9530_reduced3.rs index 6e0e78101..83efe58bf 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced3.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced3.rs @@ -36,18 +36,86 @@ fn bevy_issue_9530_reduced3__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn bevy_issue_9530_reduced3__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/bevy_issue_9530_reduced4.rs b/tests/generated/flex/bevy_issue_9530_reduced4.rs index 6b2a3c402..a033d639e 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced4.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced4.rs @@ -35,18 +35,86 @@ fn bevy_issue_9530_reduced4__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn bevy_issue_9530_reduced4__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/blitz_issue_88.rs b/tests/generated/flex/blitz_issue_88.rs index 8bbbf3c8e..ee5bd58fd 100644 --- a/tests/generated/flex/blitz_issue_88.rs +++ b/tests/generated/flex/blitz_issue_88.rs @@ -49,30 +49,182 @@ fn blitz_issue_88__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node0, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node00, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node000, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 600f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +286,180 @@ fn blitz_issue_88__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node0, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node00, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node000, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 600f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_center_child.rs b/tests/generated/flex/border_center_child.rs index 643e54c83..60ecc4bd6 100644 --- a/tests/generated/flex/border_center_child.rs +++ b/tests/generated/flex/border_center_child.rs @@ -37,18 +37,86 @@ fn border_center_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node0, 45f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn border_center_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 130f32, "height of node {:?}. Expected {}. Actual {}", node, 130f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 130f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node0, 45f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node0, 55f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_container_match_child.rs b/tests/generated/flex/border_container_match_child.rs index b320aa6ec..51c466733 100644 --- a/tests/generated/flex/border_container_match_child.rs +++ b/tests/generated/flex/border_container_match_child.rs @@ -32,18 +32,86 @@ fn border_container_match_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn border_container_match_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_flex_child.rs b/tests/generated/flex/border_flex_child.rs index 35fa229bd..e4fb1bf21 100644 --- a/tests/generated/flex/border_flex_child.rs +++ b/tests/generated/flex/border_flex_child.rs @@ -33,18 +33,86 @@ fn border_flex_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,90 @@ fn border_flex_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_no_child.rs b/tests/generated/flex/border_no_child.rs index 5d90ebed6..4f9372651 100644 --- a/tests/generated/flex/border_no_child.rs +++ b/tests/generated/flex/border_no_child.rs @@ -19,12 +19,47 @@ fn border_no_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -49,10 +84,45 @@ fn border_no_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_no_size.rs b/tests/generated/flex/border_no_size.rs index 08ec572ae..019dd5d27 100644 --- a/tests/generated/flex/border_no_size.rs +++ b/tests/generated/flex/border_no_size.rs @@ -20,12 +20,47 @@ fn border_no_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -51,10 +86,45 @@ fn border_no_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/border_stretch_child.rs b/tests/generated/flex/border_stretch_child.rs index aed6d96be..4d33afe2e 100644 --- a/tests/generated/flex/border_stretch_child.rs +++ b/tests/generated/flex/border_stretch_child.rs @@ -32,18 +32,86 @@ fn border_stretch_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,90 @@ fn border_stretch_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/child_min_max_width_flexing.rs b/tests/generated/flex/child_min_max_width_flexing.rs index 3899fe076..c03101c0e 100644 --- a/tests/generated/flex/child_min_max_width_flexing.rs +++ b/tests/generated/flex/child_min_max_width_flexing.rs @@ -39,24 +39,125 @@ fn child_min_max_width_flexing__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn child_min_max_width_flexing__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/child_with_padding_align_end.rs b/tests/generated/flex/child_with_padding_align_end.rs index a9918d889..723b6ef6d 100644 --- a/tests/generated/flex/child_with_padding_align_end.rs +++ b/tests/generated/flex/child_with_padding_align_end.rs @@ -38,18 +38,92 @@ fn child_with_padding_align_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +168,90 @@ fn child_with_padding_align_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/container_with_unsized_child.rs b/tests/generated/flex/container_with_unsized_child.rs index 0a9a04307..835a7f9cc 100644 --- a/tests/generated/flex/container_with_unsized_child.rs +++ b/tests/generated/flex/container_with_unsized_child.rs @@ -21,18 +21,92 @@ fn container_with_unsized_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -61,16 +135,90 @@ fn container_with_unsized_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/content_size.rs b/tests/generated/flex/content_size.rs index f8c56252d..77892fa7c 100644 --- a/tests/generated/flex/content_size.rs +++ b/tests/generated/flex/content_size.rs @@ -51,42 +51,131 @@ fn content_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node0, 85f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node00, 85f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node00, -10f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -145,40 +234,129 @@ fn content_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node0, 85f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node00, 85f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node00, -10f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/content_size_with_border.rs b/tests/generated/flex/content_size_with_border.rs new file mode 100644 index 000000000..2891249e9 --- /dev/null +++ b/tests/generated/flex/content_size_with_border.rs @@ -0,0 +1,2074 @@ +#[test] +#[allow(non_snake_case)] +fn content_size_with_border__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node1 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node2 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node3 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node4 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node5 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node6 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node7 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node8 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node9 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node10 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node11 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node12 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node13 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node14 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node15 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node16 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node17 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node18 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node19 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Scroll }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(50f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[ + node0, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10, node11, node12, node13, + node14, node15, node16, node17, node18, node19, + ], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 156f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 156f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node1).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node2).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 21f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node3).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node4).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 41f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node5).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 51f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node6).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 61f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node7).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 71f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node8).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 81f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 81f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node9).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 91f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node10).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 101f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node11).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 111f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node12).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 121f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 121f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node13).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 131f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 131f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node14).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 141f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 141f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node15).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 151f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 151f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node16).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 161f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.y), 161f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node17).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 171f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.y), 171f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node18).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 181f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.y), 181f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node19).unwrap(); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 191f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.y), 191f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 125f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_width()), + 125f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn content_size_with_border__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node1 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node2 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node3 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node4 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node5 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node6 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node7 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node8 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node9 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node10 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node11 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node12 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node13 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node14 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node15 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node16 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node17 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node18 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node19 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Scroll }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(50f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[ + node0, node1, node2, node3, node4, node5, node6, node7, node8, node9, node10, node11, node12, node13, + node14, node15, node16, node17, node18, node19, + ], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 56f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 150f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node1).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node2).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 21f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node3).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node4).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 41f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node5).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 51f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node6).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 61f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node7).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 71f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node8).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 81f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 81f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node9).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 91f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node10).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 101f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node11).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 111f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node12).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 121f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 121f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node13).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 131f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 131f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node14).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 141f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 141f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node15).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 151f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 151f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node16).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 161f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.y), 161f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node17).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 171f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.y), 171f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node18).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 181f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.y), 181f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node19).unwrap(); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.x), 7f32, layout.location.x); + } + if layout.location.y != 191f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.y), 191f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 115f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_width()), + 115f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/display_none.rs b/tests/generated/flex/display_none.rs index aab742dba..ba2a758a4 100644 --- a/tests/generated/flex/display_none.rs +++ b/tests/generated/flex/display_none.rs @@ -24,24 +24,131 @@ fn display_none__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,22 +189,129 @@ fn display_none__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_absolute_child.rs b/tests/generated/flex/display_none_absolute_child.rs index 691ca6e39..a318dec65 100644 --- a/tests/generated/flex/display_none_absolute_child.rs +++ b/tests/generated/flex/display_none_absolute_child.rs @@ -33,24 +33,131 @@ fn display_none_absolute_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,22 +203,129 @@ fn display_none_absolute_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_fixed_size.rs b/tests/generated/flex/display_none_fixed_size.rs index 5cdfe3375..6e64424ac 100644 --- a/tests/generated/flex/display_none_fixed_size.rs +++ b/tests/generated/flex/display_none_fixed_size.rs @@ -31,24 +31,131 @@ fn display_none_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,22 +199,129 @@ fn display_none_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_only_node.rs b/tests/generated/flex/display_none_only_node.rs index 71a7bb570..6eb8bce43 100644 --- a/tests/generated/flex/display_none_only_node.rs +++ b/tests/generated/flex/display_none_only_node.rs @@ -18,12 +18,47 @@ fn display_none_only_node__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -47,10 +82,45 @@ fn display_none_only_node__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_with_child.rs b/tests/generated/flex/display_none_with_child.rs index 903dfa829..2c13ea9b8 100644 --- a/tests/generated/flex/display_none_with_child.rs +++ b/tests/generated/flex/display_none_with_child.rs @@ -58,36 +58,215 @@ fn display_none_with_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -155,34 +334,213 @@ fn display_none_with_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_with_margin.rs b/tests/generated/flex/display_none_with_margin.rs index 58a01a17a..3539fb311 100644 --- a/tests/generated/flex/display_none_with_margin.rs +++ b/tests/generated/flex/display_none_with_margin.rs @@ -37,24 +37,131 @@ fn display_none_with_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,22 +211,129 @@ fn display_none_with_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_with_position.rs b/tests/generated/flex/display_none_with_position.rs index 708aefe75..612ce7ec1 100644 --- a/tests/generated/flex/display_none_with_position.rs +++ b/tests/generated/flex/display_none_with_position.rs @@ -29,24 +29,131 @@ fn display_none_with_position__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,22 +195,129 @@ fn display_none_with_position__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/display_none_with_position_absolute.rs b/tests/generated/flex/display_none_with_position_absolute.rs index 76b9789d7..6470ba977 100644 --- a/tests/generated/flex/display_none_with_position_absolute.rs +++ b/tests/generated/flex/display_none_with_position_absolute.rs @@ -31,18 +31,86 @@ fn display_none_with_position_absolute__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn display_none_with_position_absolute__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c52f79796..1e0fdc049 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 @@ -45,42 +45,137 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 50f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 50f32, - layout.scroll_height() - ); + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -133,40 +228,135 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 50f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 50f32, - layout.scroll_height() - ); + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_absolute_overflow_clip.rs b/tests/generated/flex/flex_absolute_overflow_clip.rs new file mode 100644 index 000000000..15539523a --- /dev/null +++ b/tests/generated/flex/flex_absolute_overflow_clip.rs @@ -0,0 +1,287 @@ +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_absolute_overflow_hidden.rs b/tests/generated/flex/flex_absolute_overflow_hidden.rs new file mode 100644 index 000000000..41eec243f --- /dev/null +++ b/tests/generated/flex/flex_absolute_overflow_hidden.rs @@ -0,0 +1,293 @@ +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_absolute_overflow_scroll.rs b/tests/generated/flex/flex_absolute_overflow_scroll.rs new file mode 100644 index 000000000..f85acf00f --- /dev/null +++ b/tests/generated/flex/flex_absolute_overflow_scroll.rs @@ -0,0 +1,293 @@ +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 66f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 66f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 43f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 43f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 52f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 52f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_absolute_overflow_visible.rs b/tests/generated/flex/flex_absolute_overflow_visible.rs new file mode 100644 index 000000000..6b9d5db5a --- /dev/null +++ b/tests/generated/flex/flex_absolute_overflow_visible.rs @@ -0,0 +1,283 @@ +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_absolute_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} 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 d3b3c0563..6fce54ea3 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 @@ -39,24 +39,125 @@ fn flex_basis_and_main_dimen_set_when_flexing__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +204,123 @@ fn flex_basis_and_main_dimen_set_when_flexing__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_flex_grow_column.rs b/tests/generated/flex/flex_basis_flex_grow_column.rs index 58b55d1e4..2e2523e8c 100644 --- a/tests/generated/flex/flex_basis_flex_grow_column.rs +++ b/tests/generated/flex/flex_basis_flex_grow_column.rs @@ -29,24 +29,125 @@ fn flex_basis_flex_grow_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node0, 75f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,22 +189,123 @@ fn flex_basis_flex_grow_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node0, 75f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_flex_grow_row.rs b/tests/generated/flex/flex_basis_flex_grow_row.rs index ada880e52..d642a6370 100644 --- a/tests/generated/flex/flex_basis_flex_grow_row.rs +++ b/tests/generated/flex/flex_basis_flex_grow_row.rs @@ -28,24 +28,137 @@ fn flex_basis_flex_grow_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node0, 75f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node1, 25f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +199,135 @@ fn flex_basis_flex_grow_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node0, 75f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node1, 25f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_flex_shrink_column.rs b/tests/generated/flex/flex_basis_flex_shrink_column.rs index fc0b36347..46cb587ab 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_column.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_column.rs @@ -30,24 +30,125 @@ fn flex_basis_flex_shrink_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node1, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node1, 67f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,22 +189,123 @@ fn flex_basis_flex_shrink_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node1, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node1, 67f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_flex_shrink_row.rs b/tests/generated/flex/flex_basis_flex_shrink_row.rs index 052ddd6e8..df72fe8f7 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_row.rs @@ -29,24 +29,137 @@ fn flex_basis_flex_shrink_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node0, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node1, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +199,135 @@ fn flex_basis_flex_shrink_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node0, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node1, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 aef8efd85..51864ce91 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_column.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_column.rs @@ -37,24 +37,131 @@ fn flex_basis_larger_than_content_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +206,129 @@ fn flex_basis_larger_than_content_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 17345b5a6..96409c3ca 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_row.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_row.rs @@ -36,24 +36,137 @@ fn flex_basis_larger_than_content_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +210,135 @@ fn flex_basis_larger_than_content_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_overrides_main_size.rs b/tests/generated/flex/flex_basis_overrides_main_size.rs index 4b77a7fcb..b4f4753fc 100644 --- a/tests/generated/flex/flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/flex_basis_overrides_main_size.rs @@ -42,30 +42,182 @@ fn flex_basis_overrides_main_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +268,180 @@ fn flex_basis_overrides_main_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4994271a3..03bfc119e 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 @@ -57,36 +57,227 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9e78f965f..0fa8299ae 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_column.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_column.rs @@ -37,24 +37,137 @@ fn flex_basis_smaller_than_content_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +212,135 @@ fn flex_basis_smaller_than_content_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f6f208a05..da966bf80 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_row.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_row.rs @@ -36,24 +36,137 @@ fn flex_basis_smaller_than_content_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +210,135 @@ fn flex_basis_smaller_than_content_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f8f667bcc..c68236ba4 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 @@ -28,18 +28,86 @@ fn flex_basis_smaller_than_main_dimen_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn flex_basis_smaller_than_main_dimen_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 22c474d71..edc9a3086 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 @@ -27,18 +27,86 @@ fn flex_basis_smaller_than_main_dimen_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +140,84 @@ fn flex_basis_smaller_than_main_dimen_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2355f6d1a..d3bdebe04 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 @@ -57,36 +57,227 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 36c0d7f0e..b6ae090cf 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 @@ -57,36 +57,227 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 80f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 80f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e80850837..cf334dff4 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 @@ -49,36 +49,227 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,34 +332,225 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ecf7402a6..27ce58842 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 @@ -57,36 +57,227 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_unconstraint_column.rs b/tests/generated/flex/flex_basis_unconstraint_column.rs index 2a9f1f7db..8eba77d47 100644 --- a/tests/generated/flex/flex_basis_unconstraint_column.rs +++ b/tests/generated/flex/flex_basis_unconstraint_column.rs @@ -21,18 +21,86 @@ fn flex_basis_unconstraint_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -63,16 +131,84 @@ fn flex_basis_unconstraint_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_basis_unconstraint_row.rs b/tests/generated/flex/flex_basis_unconstraint_row.rs index 122ff042b..2be1a33c8 100644 --- a/tests/generated/flex/flex_basis_unconstraint_row.rs +++ b/tests/generated/flex/flex_basis_unconstraint_row.rs @@ -16,18 +16,92 @@ fn flex_basis_unconstraint_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +128,90 @@ fn flex_basis_unconstraint_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2468fd855..1d4def79d 100644 --- a/tests/generated/flex/flex_basis_zero_undefined_main_size.rs +++ b/tests/generated/flex/flex_basis_zero_undefined_main_size.rs @@ -28,24 +28,131 @@ fn flex_basis_zero_undefined_main_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -85,22 +192,129 @@ fn flex_basis_zero_undefined_main_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_column_relative_all_sides.rs b/tests/generated/flex/flex_column_relative_all_sides.rs index 115ae42ac..7a7a13471 100644 --- a/tests/generated/flex/flex_column_relative_all_sides.rs +++ b/tests/generated/flex/flex_column_relative_all_sides.rs @@ -33,18 +33,86 @@ fn flex_column_relative_all_sides__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,84 @@ fn flex_column_relative_all_sides__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_column.rs b/tests/generated/flex/flex_direction_column.rs index 57b34df73..275c01b2d 100644 --- a/tests/generated/flex/flex_direction_column.rs +++ b/tests/generated/flex/flex_direction_column.rs @@ -39,30 +39,164 @@ fn flex_direction_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +244,162 @@ fn flex_direction_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_column_no_height.rs b/tests/generated/flex/flex_direction_column_no_height.rs index e2bb6e282..cf9c3ee7d 100644 --- a/tests/generated/flex/flex_direction_column_no_height.rs +++ b/tests/generated/flex/flex_direction_column_no_height.rs @@ -36,30 +36,164 @@ fn flex_direction_column_no_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,28 +238,162 @@ fn flex_direction_column_no_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_column_reverse.rs b/tests/generated/flex/flex_direction_column_reverse.rs index ea5a89f47..54ec64aa1 100644 --- a/tests/generated/flex/flex_direction_column_reverse.rs +++ b/tests/generated/flex/flex_direction_column_reverse.rs @@ -39,30 +39,164 @@ fn flex_direction_column_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node2, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +244,162 @@ fn flex_direction_column_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node2, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e98bc75bc..7273a9484 100644 --- a/tests/generated/flex/flex_direction_column_reverse_no_height.rs +++ b/tests/generated/flex/flex_direction_column_reverse_no_height.rs @@ -36,30 +36,164 @@ fn flex_direction_column_reverse_no_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,28 +238,162 @@ fn flex_direction_column_reverse_no_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_row.rs b/tests/generated/flex/flex_direction_row.rs index 941b10e20..639813d4f 100644 --- a/tests/generated/flex/flex_direction_row.rs +++ b/tests/generated/flex/flex_direction_row.rs @@ -38,30 +38,182 @@ fn flex_direction_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -108,28 +260,180 @@ fn flex_direction_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_row_no_width.rs b/tests/generated/flex/flex_direction_row_no_width.rs index 38e58b590..d9d59750e 100644 --- a/tests/generated/flex/flex_direction_row_no_width.rs +++ b/tests/generated/flex/flex_direction_row_no_width.rs @@ -35,30 +35,182 @@ fn flex_direction_row_no_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -102,28 +254,180 @@ fn flex_direction_row_no_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_direction_row_reverse.rs b/tests/generated/flex/flex_direction_row_reverse.rs index 99b0a2ac7..44cb78ae6 100644 --- a/tests/generated/flex/flex_direction_row_reverse.rs +++ b/tests/generated/flex/flex_direction_row_reverse.rs @@ -39,30 +39,182 @@ fn flex_direction_row_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn flex_direction_row_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_0_min_size.rs b/tests/generated/flex/flex_grow_0_min_size.rs index 704c2e1e1..b519db231 100644 --- a/tests/generated/flex/flex_grow_0_min_size.rs +++ b/tests/generated/flex/flex_grow_0_min_size.rs @@ -71,36 +71,203 @@ fn flex_grow_0_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 98f32, "height of node {:?}. Expected {}. Actual {}", node0, 98f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 98f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 98f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 98f32, "height of node {:?}. Expected {}. Actual {}", node1, 98f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node1, 1f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 98f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 98f32, layout.size.height); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 98f32, "height of node {:?}. Expected {}. Actual {}", node2, 98f32, size.height); - assert_eq!(location.x, 61f32, "x of node {:?}. Expected {}. Actual {}", node2, 61f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node2, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 98f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 98f32, layout.size.height); + } + if layout.location.x != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 61f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 98f32, "height of node {:?}. Expected {}. Actual {}", node3, 98f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node3, 111f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node3, 1f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 98f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 98f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +348,225 @@ fn flex_grow_0_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 402f32, "width of node {:?}. Expected {}. Actual {}", node, 402f32, size.width); - assert_eq!(size.height, 102f32, "height of node {:?}. Expected {}. Actual {}", node, 102f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 402f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 402f32, layout.size.width); + } + if layout.size.height != 102f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 102f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node1, 1f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 61f32, "x of node {:?}. Expected {}. Actual {}", node2, 61f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node2, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 61f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node3, 111f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node3, 1f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_child.rs b/tests/generated/flex/flex_grow_child.rs index dcbd9050f..7861111ae 100644 --- a/tests/generated/flex/flex_grow_child.rs +++ b/tests/generated/flex/flex_grow_child.rs @@ -17,18 +17,92 @@ fn flex_grow_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -56,16 +130,90 @@ fn flex_grow_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e0479e478..ab2101945 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 @@ -40,24 +40,125 @@ fn flex_grow_flex_basis_percent_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -105,22 +206,123 @@ fn flex_grow_flex_basis_percent_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_height_maximized.rs b/tests/generated/flex/flex_grow_height_maximized.rs index d95cfadcf..e22f61858 100644 --- a/tests/generated/flex/flex_grow_height_maximized.rs +++ b/tests/generated/flex/flex_grow_height_maximized.rs @@ -46,30 +46,182 @@ fn flex_grow_height_maximized__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node00, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node01, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 400f32, "y of node {:?}. Expected {}. Actual {}", node01, 400f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 400f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -124,28 +276,180 @@ fn flex_grow_height_maximized__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node0, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 500f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node00, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node01, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 400f32, "y of node {:?}. Expected {}. Actual {}", node01, 400f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 400f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 169041e47..be08bb9aa 100644 --- a/tests/generated/flex/flex_grow_in_at_most_container.rs +++ b/tests/generated/flex/flex_grow_in_at_most_container.rs @@ -29,24 +29,125 @@ fn flex_grow_in_at_most_container__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,22 +188,123 @@ fn flex_grow_in_at_most_container__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 45ff95529..d38ac16c0 100644 --- a/tests/generated/flex/flex_grow_less_than_factor_one.rs +++ b/tests/generated/flex/flex_grow_less_than_factor_one.rs @@ -32,30 +32,182 @@ fn flex_grow_less_than_factor_one__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 132f32, "width of node {:?}. Expected {}. Actual {}", node0, 132f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 132f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 92f32, "width of node {:?}. Expected {}. Actual {}", node1, 92f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 132f32, "x of node {:?}. Expected {}. Actual {}", node1, 132f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 92f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 132f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node2, 184f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node2, 200f32, size.height); - assert_eq!(location.x, 224f32, "x of node {:?}. Expected {}. Actual {}", node2, 224f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 224f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 224f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -106,28 +258,180 @@ fn flex_grow_less_than_factor_one__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 132f32, "width of node {:?}. Expected {}. Actual {}", node0, 132f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 132f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 92f32, "width of node {:?}. Expected {}. Actual {}", node1, 92f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 132f32, "x of node {:?}. Expected {}. Actual {}", node1, 132f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 92f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 132f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 184f32, "width of node {:?}. Expected {}. Actual {}", node2, 184f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node2, 200f32, size.height); - assert_eq!(location.x, 224f32, "x of node {:?}. Expected {}. Actual {}", node2, 224f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 184f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 184f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 224f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 224f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_root_minimized.rs b/tests/generated/flex/flex_grow_root_minimized.rs index d09f5c8ba..92dd7251f 100644 --- a/tests/generated/flex/flex_grow_root_minimized.rs +++ b/tests/generated/flex/flex_grow_root_minimized.rs @@ -45,30 +45,182 @@ fn flex_grow_root_minimized__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node0, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node01, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node01, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +274,180 @@ fn flex_grow_root_minimized__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node0, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node01, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node01, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_shrink_at_most.rs b/tests/generated/flex/flex_grow_shrink_at_most.rs index 2869417e6..2b6858686 100644 --- a/tests/generated/flex/flex_grow_shrink_at_most.rs +++ b/tests/generated/flex/flex_grow_shrink_at_most.rs @@ -23,24 +23,137 @@ fn flex_grow_shrink_at_most__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,22 +193,135 @@ fn flex_grow_shrink_at_most__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_to_min.rs b/tests/generated/flex/flex_grow_to_min.rs index fd8227502..9a6187882 100644 --- a/tests/generated/flex/flex_grow_to_min.rs +++ b/tests/generated/flex/flex_grow_to_min.rs @@ -28,24 +28,125 @@ fn flex_grow_to_min__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +187,123 @@ fn flex_grow_to_min__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e15487492..e31832d44 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_column.rs @@ -32,24 +32,125 @@ fn flex_grow_within_constrained_max_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node1, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node1, 67f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -89,22 +190,123 @@ fn flex_grow_within_constrained_max_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node1, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node1, 67f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 35c28306c..4f0cf6bd5 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_row.rs @@ -41,30 +41,182 @@ fn flex_grow_within_constrained_max_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node00, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node01, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node01, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +266,180 @@ fn flex_grow_within_constrained_max_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node00, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node01, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node01, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 71f7134c8..f0c109565 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_width.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_width.rs @@ -37,24 +37,131 @@ fn flex_grow_within_constrained_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +206,129 @@ fn flex_grow_within_constrained_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2685097ca..b264c7421 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_column.rs @@ -25,24 +25,125 @@ fn flex_grow_within_constrained_min_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,22 +181,123 @@ fn flex_grow_within_constrained_min_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 53a088c11..a41b18d80 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 @@ -26,24 +26,125 @@ fn flex_grow_within_constrained_min_max_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,22 +183,123 @@ fn flex_grow_within_constrained_min_max_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b15c05ed7..c2ef49a54 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_row.rs @@ -25,24 +25,137 @@ fn flex_grow_within_constrained_min_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,22 +193,135 @@ fn flex_grow_within_constrained_min_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_grow_within_max_width.rs b/tests/generated/flex/flex_grow_within_max_width.rs index 3eacaa036..a04006bef 100644 --- a/tests/generated/flex/flex_grow_within_max_width.rs +++ b/tests/generated/flex/flex_grow_within_max_width.rs @@ -37,24 +37,131 @@ fn flex_grow_within_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +206,129 @@ fn flex_grow_within_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_inflow_overflow_clip.rs b/tests/generated/flex/flex_inflow_overflow_clip.rs new file mode 100644 index 000000000..6f55ae396 --- /dev/null +++ b/tests/generated/flex/flex_inflow_overflow_clip.rs @@ -0,0 +1,273 @@ +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_inflow_overflow_hidden.rs b/tests/generated/flex/flex_inflow_overflow_hidden.rs new file mode 100644 index 000000000..e2a9deadf --- /dev/null +++ b/tests/generated/flex/flex_inflow_overflow_hidden.rs @@ -0,0 +1,279 @@ +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 64f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 64f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_inflow_overflow_scroll.rs b/tests/generated/flex/flex_inflow_overflow_scroll.rs new file mode 100644 index 000000000..b1ba5869c --- /dev/null +++ b/tests/generated/flex/flex_inflow_overflow_scroll.rs @@ -0,0 +1,279 @@ +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 79f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 79f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 13f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 65f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_inflow_overflow_visible.rs b/tests/generated/flex/flex_inflow_overflow_visible.rs new file mode 100644 index 000000000..bb1389bbd --- /dev/null +++ b/tests/generated/flex/flex_inflow_overflow_visible.rs @@ -0,0 +1,269 @@ +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn flex_inflow_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/flex/flex_root_ignored.rs b/tests/generated/flex/flex_root_ignored.rs index 473afe243..213075348 100644 --- a/tests/generated/flex/flex_root_ignored.rs +++ b/tests/generated/flex/flex_root_ignored.rs @@ -33,24 +33,137 @@ fn flex_root_ignored__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node1, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +204,135 @@ fn flex_root_ignored__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node1, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_row_relative_all_sides.rs b/tests/generated/flex/flex_row_relative_all_sides.rs index 6a066db34..a9709ed26 100644 --- a/tests/generated/flex/flex_row_relative_all_sides.rs +++ b/tests/generated/flex/flex_row_relative_all_sides.rs @@ -32,18 +32,92 @@ fn flex_row_relative_all_sides__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +156,90 @@ fn flex_row_relative_all_sides__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d3fe04d59..c53baa1ef 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 @@ -29,18 +29,86 @@ fn flex_shrink_by_outer_margin_with_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn flex_shrink_by_outer_margin_with_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 438bd9b85..cd554142b 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 @@ -42,24 +42,137 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node0, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node1, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +222,135 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node0, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node1, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_shrink_flex_grow_row.rs b/tests/generated/flex/flex_shrink_flex_grow_row.rs index 6ced3faf1..bcddb0e3e 100644 --- a/tests/generated/flex/flex_shrink_flex_grow_row.rs +++ b/tests/generated/flex/flex_shrink_flex_grow_row.rs @@ -42,24 +42,137 @@ fn flex_shrink_flex_grow_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node0, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node1, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +222,135 @@ fn flex_shrink_flex_grow_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node0, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node1, 250f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/flex_shrink_to_zero.rs b/tests/generated/flex/flex_shrink_to_zero.rs index 7c87a1bc3..6a4267c81 100644 --- a/tests/generated/flex/flex_shrink_to_zero.rs +++ b/tests/generated/flex/flex_shrink_to_zero.rs @@ -47,30 +47,164 @@ fn flex_shrink_to_zero__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node, 75f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 25f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -126,28 +260,162 @@ fn flex_shrink_to_zero__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node, 75f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 25f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 345bf6440..e32a20cd8 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 @@ -33,24 +33,137 @@ fn flex_wrap_align_stretch_fits_one_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +204,135 @@ fn flex_wrap_align_stretch_fits_one_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 58f819e75..0a3fe531f 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 @@ -34,24 +34,125 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node0, 55f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node1, 55f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,22 +194,123 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node0, 55f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 55f32, "width of node {:?}. Expected {}. Actual {}", node1, 55f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node1, 50f32, location.y); + if layout.size.width != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 55f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 12000f2a7..046aed878 100644 --- a/tests/generated/flex/flex_wrap_wrap_to_child_height.rs +++ b/tests/generated/flex/flex_wrap_wrap_to_child_height.rs @@ -52,36 +52,233 @@ fn flex_wrap_wrap_to_child_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node000, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 100f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,34 +343,231 @@ fn flex_wrap_wrap_to_child_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node000, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 100f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_child_margins.rs b/tests/generated/flex/gap_column_gap_child_margins.rs index 88bcdf7fa..87a65bb3f 100644 --- a/tests/generated/flex/gap_column_gap_child_margins.rs +++ b/tests/generated/flex/gap_column_gap_child_margins.rs @@ -48,30 +48,182 @@ fn gap_column_gap_child_margins__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node0, 2f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node1, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 26f32, "x of node {:?}. Expected {}. Actual {}", node1, 26f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 26f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node2, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -128,28 +280,180 @@ fn gap_column_gap_child_margins__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node0, 2f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node1, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 26f32, "x of node {:?}. Expected {}. Actual {}", node1, 26f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 26f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node2, 2f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f05975f51..4ccdd5f3b 100644 --- a/tests/generated/flex/gap_column_gap_determines_parent_width.rs +++ b/tests/generated/flex/gap_column_gap_determines_parent_width.rs @@ -37,30 +37,182 @@ fn gap_column_gap_determines_parent_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -106,28 +258,180 @@ fn gap_column_gap_determines_parent_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_flexible.rs b/tests/generated/flex/gap_column_gap_flexible.rs index 4f1e26453..b585d30ee 100644 --- a/tests/generated/flex/gap_column_gap_flexible.rs +++ b/tests/generated/flex/gap_column_gap_flexible.rs @@ -45,30 +45,182 @@ fn gap_column_gap_flexible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +274,180 @@ fn gap_column_gap_flexible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 37e14f67c..1ff2f1e81 100644 --- a/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs @@ -42,30 +42,182 @@ fn gap_column_gap_flexible_undefined_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +268,180 @@ fn gap_column_gap_flexible_undefined_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_inflexible.rs b/tests/generated/flex/gap_column_gap_inflexible.rs index 3c6547173..149384e03 100644 --- a/tests/generated/flex/gap_column_gap_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_inflexible.rs @@ -39,30 +39,182 @@ fn gap_column_gap_inflexible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn gap_column_gap_inflexible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bda2940e1..b6d695fcc 100644 --- a/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs @@ -36,30 +36,182 @@ fn gap_column_gap_inflexible_undefined_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,28 +256,180 @@ fn gap_column_gap_inflexible_undefined_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_justify_center.rs b/tests/generated/flex/gap_column_gap_justify_center.rs index 098794257..00d636203 100644 --- a/tests/generated/flex/gap_column_gap_justify_center.rs +++ b/tests/generated/flex/gap_column_gap_justify_center.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1b351f296..3f42226da 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_end.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_end.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ee3401071..f184485fd 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_start.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_start.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 927b748b6..789555b90 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_around.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_around.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 3f32, "x of node {:?}. Expected {}. Actual {}", node0, 3f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 3f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 77f32, "x of node {:?}. Expected {}. Actual {}", node2, 77f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 77f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 77f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 3f32, "x of node {:?}. Expected {}. Actual {}", node0, 3f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 3f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 77f32, "x of node {:?}. Expected {}. Actual {}", node2, 77f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 77f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 77f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8d665b2cc..919d89af4 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_between.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_between.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5706f0c72..21d84d23f 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_evenly.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_evenly.rs @@ -40,30 +40,182 @@ fn gap_column_gap_justify_space_evenly__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +264,180 @@ fn gap_column_gap_justify_space_evenly__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_mixed_flexible.rs b/tests/generated/flex/gap_column_gap_mixed_flexible.rs index f91104853..68c1131be 100644 --- a/tests/generated/flex/gap_column_gap_mixed_flexible.rs +++ b/tests/generated/flex/gap_column_gap_mixed_flexible.rs @@ -41,30 +41,182 @@ fn gap_column_gap_mixed_flexible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +266,180 @@ fn gap_column_gap_mixed_flexible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7b3ce7f57..dac729867 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 @@ -46,30 +46,164 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 40f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -124,28 +258,162 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 40f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 77bd05bd5..1fada954c 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs @@ -44,30 +44,164 @@ fn gap_column_gap_percentage_cyclic_shrinkable__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node0, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node1, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 24f32, "x of node {:?}. Expected {}. Actual {}", node1, 24f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 24f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node2, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node2, 48f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -120,28 +254,162 @@ fn gap_column_gap_percentage_cyclic_shrinkable__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node0, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node1, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 24f32, "x of node {:?}. Expected {}. Actual {}", node1, 24f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 24f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node2, 12f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node2, 48f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 315f0682b..26674d708 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs @@ -47,30 +47,164 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 24f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node1, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 64f32, "x of node {:?}. Expected {}. Actual {}", node2, 64f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 64f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -126,28 +260,162 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 24f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node1, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 64f32, "x of node {:?}. Expected {}. Actual {}", node2, 64f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 64f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_percentage_flexible.rs b/tests/generated/flex/gap_column_gap_percentage_flexible.rs index 3c2e3ee76..3b7775057 100644 --- a/tests/generated/flex/gap_column_gap_percentage_flexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_flexible.rs @@ -45,30 +45,182 @@ fn gap_column_gap_percentage_flexible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node0, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 26f32, "width of node {:?}. Expected {}. Actual {}", node1, 26f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 37f32, "x of node {:?}. Expected {}. Actual {}", node1, 37f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 26f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 37f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node2, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 73f32, "x of node {:?}. Expected {}. Actual {}", node2, 73f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 73f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,28 +274,180 @@ fn gap_column_gap_percentage_flexible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node0, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 26f32, "width of node {:?}. Expected {}. Actual {}", node1, 26f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 37f32, "x of node {:?}. Expected {}. Actual {}", node1, 37f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 26f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 37f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 37f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node2, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 73f32, "x of node {:?}. Expected {}. Actual {}", node2, 73f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 73f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b7d258638..ba89442c2 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 @@ -51,30 +51,164 @@ fn gap_column_gap_percentage_flexible_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 21f32, "width of node {:?}. Expected {}. Actual {}", node0, 21f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 21f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node1, 22f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 39f32, "x of node {:?}. Expected {}. Actual {}", node1, 39f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 39f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 39f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 21f32, "width of node {:?}. Expected {}. Actual {}", node2, 21f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node2, 80f32, size.height); - assert_eq!(location.x, 69f32, "x of node {:?}. Expected {}. Actual {}", node2, 69f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 21f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 21f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 69f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 69f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,28 +268,180 @@ fn gap_column_gap_percentage_flexible_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node0, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 26f32, "width of node {:?}. Expected {}. Actual {}", node1, 26f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 47f32, "x of node {:?}. Expected {}. Actual {}", node1, 47f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 26f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 47f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 47f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 27f32, "width of node {:?}. Expected {}. Actual {}", node2, 27f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 83f32, "x of node {:?}. Expected {}. Actual {}", node2, 83f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 27f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 83f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 83f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs index 27e1c2e2d..31217a205 100644 --- a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs @@ -39,30 +39,182 @@ fn gap_column_gap_percentage_inflexible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn gap_column_gap_percentage_inflexible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6621fe530..631749a74 100644 --- a/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs @@ -100,66 +100,398 @@ fn gap_column_gap_row_gap_wrapping__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -274,64 +606,396 @@ fn gap_column_gap_row_gap_wrapping__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_gap_start_index.rs b/tests/generated/flex/gap_column_gap_start_index.rs index c33af18a3..7a3c39c10 100644 --- a/tests/generated/flex/gap_column_gap_start_index.rs +++ b/tests/generated/flex/gap_column_gap_start_index.rs @@ -56,36 +56,203 @@ fn gap_column_gap_start_index__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node2, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -151,34 +318,201 @@ fn gap_column_gap_start_index__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node2, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d637b776a..3cf8fd5b0 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_center.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_center.rs @@ -77,48 +77,281 @@ fn gap_column_gap_wrap_align_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node4, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node5, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -207,46 +440,279 @@ fn gap_column_gap_wrap_align_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node4, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node5, 60f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 105978f73..db726087c 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 @@ -77,48 +77,281 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -207,46 +440,279 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2938fd10c..e901a6e68 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 @@ -77,48 +77,281 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -207,46 +440,279 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8a97bee37..89bdcb8dd 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 @@ -77,48 +77,281 @@ fn gap_column_gap_wrap_align_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node4, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node5, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -207,46 +440,279 @@ fn gap_column_gap_wrap_align_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node4, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node5, 70f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1b5f68d8c..5faa9d8d5 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 @@ -77,48 +77,281 @@ fn gap_column_gap_wrap_align_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -207,46 +440,279 @@ fn gap_column_gap_wrap_align_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b821aa884..548b1b566 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs @@ -58,42 +58,272 @@ fn gap_column_gap_wrap_align_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node0, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node0, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node1, 72f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 76f32, "x of node {:?}. Expected {}. Actual {}", node1, 76f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 76f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 76f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node2, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node2, 150f32, size.height); - assert_eq!(location.x, 153f32, "x of node {:?}. Expected {}. Actual {}", node2, 153f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 153f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 153f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node3, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node3, 150f32, size.height); - assert_eq!(location.x, 229f32, "x of node {:?}. Expected {}. Actual {}", node3, 229f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 229f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 229f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node4, 300f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node4, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node4, 150f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,40 +392,270 @@ fn gap_column_gap_wrap_align_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node0, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node0, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 72f32, "width of node {:?}. Expected {}. Actual {}", node1, 72f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 76f32, "x of node {:?}. Expected {}. Actual {}", node1, 76f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 76f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 76f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node2, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node2, 150f32, size.height); - assert_eq!(location.x, 153f32, "x of node {:?}. Expected {}. Actual {}", node2, 153f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 153f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 153f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node3, 71f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node3, 150f32, size.height); - assert_eq!(location.x, 229f32, "x of node {:?}. Expected {}. Actual {}", node3, 229f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 229f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 229f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node4, 300f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node4, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node4, 150f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_column_row_gap_wrapping.rs b/tests/generated/flex/gap_column_row_gap_wrapping.rs index 73645318e..65bf590d4 100644 --- a/tests/generated/flex/gap_column_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_row_gap_wrapping.rs @@ -100,66 +100,398 @@ fn gap_column_row_gap_wrapping__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -274,64 +606,396 @@ fn gap_column_row_gap_wrapping__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 96b018f97..6b18e8282 100644 --- a/tests/generated/flex/gap_row_gap_align_items_end.rs +++ b/tests/generated/flex/gap_row_gap_align_items_end.rs @@ -59,48 +59,281 @@ fn gap_row_gap_align_items_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node3, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node4, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node5, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -171,46 +404,279 @@ fn gap_row_gap_align_items_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node1, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node3, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node4, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node5, 200f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a09ea39a3..b5e91a716 100644 --- a/tests/generated/flex/gap_row_gap_align_items_stretch.rs +++ b/tests/generated/flex/gap_row_gap_align_items_stretch.rs @@ -60,48 +60,281 @@ fn gap_row_gap_align_items_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node2, 90f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node3, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node3, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node4, 90f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node4, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node5, 90f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node5, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,46 +406,279 @@ fn gap_row_gap_align_items_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node2, 90f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node3, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node3, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node4, 90f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node4, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node5, 90f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 110f32, "y of node {:?}. Expected {}. Actual {}", node5, 110f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 110f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0e4b4a6c4..4b139184b 100644 --- a/tests/generated/flex/gap_row_gap_column_child_margins.rs +++ b/tests/generated/flex/gap_row_gap_column_child_margins.rs @@ -49,30 +49,164 @@ fn gap_row_gap_column_child_margins__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node0, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node1, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 66f32, "y of node {:?}. Expected {}. Actual {}", node1, 66f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 66f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node2, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 143f32, "y of node {:?}. Expected {}. Actual {}", node2, 143f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 143f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 143f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -130,28 +264,162 @@ fn gap_row_gap_column_child_margins__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node0, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node1, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 66f32, "y of node {:?}. Expected {}. Actual {}", node1, 66f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 66f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node2, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 143f32, "y of node {:?}. Expected {}. Actual {}", node2, 143f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 143f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 143f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3cb12710f..8ba71208d 100644 --- a/tests/generated/flex/gap_row_gap_determines_parent_height.rs +++ b/tests/generated/flex/gap_row_gap_determines_parent_height.rs @@ -38,30 +38,164 @@ fn gap_row_gap_determines_parent_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -108,28 +242,162 @@ fn gap_row_gap_determines_parent_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs index f972ade45..f774f29fa 100644 --- a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs +++ b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs @@ -100,66 +100,398 @@ fn gap_row_gap_percentage_wrapping__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node3, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node5, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -274,64 +606,396 @@ fn gap_row_gap_percentage_wrapping__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node3, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node4, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node5, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node7, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 203ffd18c..4afc8287a 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 @@ -43,30 +43,164 @@ fn gap_row_gap_row_wrap_child_margins__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node0, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node1, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 66f32, "y of node {:?}. Expected {}. Actual {}", node1, 66f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 66f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node2, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 143f32, "y of node {:?}. Expected {}. Actual {}", node2, 143f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 143f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 143f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn gap_row_gap_row_wrap_child_margins__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node0, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node1, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 66f32, "y of node {:?}. Expected {}. Actual {}", node1, 66f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 66f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node2, 42f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 143f32, "y of node {:?}. Expected {}. Actual {}", node2, 143f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 143f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 143f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs index 63bfff122..d749152f3 100644 --- a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs @@ -14,12 +14,47 @@ fn intrinsic_sizing_cross_size_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -42,10 +77,45 @@ fn intrinsic_sizing_cross_size_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/intrinsic_sizing_main_size_column.rs b/tests/generated/flex/intrinsic_sizing_main_size_column.rs index 4fea3b7af..69314ea08 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column.rs @@ -14,12 +14,47 @@ fn intrinsic_sizing_main_size_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -42,10 +77,45 @@ fn intrinsic_sizing_main_size_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7003aad91..ede6b81ed 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs @@ -20,18 +20,86 @@ fn intrinsic_sizing_main_size_column_nested__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -64,16 +132,84 @@ fn intrinsic_sizing_main_size_column_nested__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 867df3aa3..f0b4c4192 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs @@ -30,24 +30,125 @@ fn intrinsic_sizing_main_size_column_wrap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +192,123 @@ fn intrinsic_sizing_main_size_column_wrap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs b/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs index e7f26e8b4..3b84dfaf6 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs @@ -60,24 +60,131 @@ fn intrinsic_sizing_main_size_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node0, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -145,22 +252,129 @@ fn intrinsic_sizing_main_size_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node00, 70f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 70f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/intrinsic_sizing_main_size_row.rs b/tests/generated/flex/intrinsic_sizing_main_size_row.rs index 07712527b..fb8f4c803 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row.rs @@ -14,12 +14,47 @@ fn intrinsic_sizing_main_size_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -38,10 +73,45 @@ fn intrinsic_sizing_main_size_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b277a6d65..727f3c0ad 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs @@ -15,18 +15,86 @@ fn intrinsic_sizing_main_size_row_nested__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -51,16 +119,84 @@ fn intrinsic_sizing_main_size_row_nested__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b4a0f25a0..dc79f7026 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs @@ -26,24 +26,125 @@ fn intrinsic_sizing_main_size_row_wrap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,22 +179,123 @@ fn intrinsic_sizing_main_size_row_wrap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_center.rs b/tests/generated/flex/justify_content_column_center.rs index a6fdaeb46..4c79e2420 100644 --- a/tests/generated/flex/justify_content_column_center.rs +++ b/tests/generated/flex/justify_content_column_center.rs @@ -40,30 +40,164 @@ fn justify_content_column_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node0, 35f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node0, 35f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node2, 55f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 58283e5ad..65d1fe4b0 100644 --- a/tests/generated/flex/justify_content_column_center_negative_space.rs +++ b/tests/generated/flex/justify_content_column_center_negative_space.rs @@ -71,36 +71,221 @@ fn justify_content_column_center_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node00, -25f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node02, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_center_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -25f32, "y of node {:?}. Expected {}. Actual {}", node00, -25f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node02, 15f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b549f129a..0ad976798 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 @@ -72,36 +72,221 @@ fn justify_content_column_center_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 35f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 35f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -35f32, "y of node {:?}. Expected {}. Actual {}", node00, -35f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node02, 25f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_center_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 35f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 35f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -35f32, "y of node {:?}. Expected {}. Actual {}", node00, -35f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node01, -5f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node02, 25f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_end.rs b/tests/generated/flex/justify_content_column_end.rs index 394c1f122..27cfa28c0 100644 --- a/tests/generated/flex/justify_content_column_end.rs +++ b/tests/generated/flex/justify_content_column_end.rs @@ -40,30 +40,164 @@ fn justify_content_column_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8bc66a046..b5f737ff5 100644 --- a/tests/generated/flex/justify_content_column_end_negative_space.rs +++ b/tests/generated/flex/justify_content_column_end_negative_space.rs @@ -71,36 +71,221 @@ fn justify_content_column_end_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node00, -50f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -30f32, "y of node {:?}. Expected {}. Actual {}", node01, -30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_end_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node00, -50f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -30f32, "y of node {:?}. Expected {}. Actual {}", node01, -30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b01408178..9afbd2990 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 @@ -72,36 +72,221 @@ fn justify_content_column_end_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -70f32, "y of node {:?}. Expected {}. Actual {}", node00, -70f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, -40f32, "y of node {:?}. Expected {}. Actual {}", node01, -40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_end_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, -70f32, "y of node {:?}. Expected {}. Actual {}", node00, -70f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, -40f32, "y of node {:?}. Expected {}. Actual {}", node01, -40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_end_reverse.rs b/tests/generated/flex/justify_content_column_end_reverse.rs index aeba387f4..2e6fa6bce 100644 --- a/tests/generated/flex/justify_content_column_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_end_reverse.rs @@ -40,30 +40,164 @@ fn justify_content_column_end_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_end_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_flex_end.rs b/tests/generated/flex/justify_content_column_flex_end.rs index e4a0ebd08..d5b92bf6a 100644 --- a/tests/generated/flex/justify_content_column_flex_end.rs +++ b/tests/generated/flex/justify_content_column_flex_end.rs @@ -40,30 +40,164 @@ fn justify_content_column_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d1012cbf9..42a65e8c6 100644 --- a/tests/generated/flex/justify_content_column_flex_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_end_reverse.rs @@ -40,30 +40,164 @@ fn justify_content_column_flex_end_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_flex_end_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_flex_start.rs b/tests/generated/flex/justify_content_column_flex_start.rs index 36ce0b2c7..cf2e60f1d 100644 --- a/tests/generated/flex/justify_content_column_flex_start.rs +++ b/tests/generated/flex/justify_content_column_flex_start.rs @@ -40,30 +40,164 @@ fn justify_content_column_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 510ec63ed..6585aa247 100644 --- a/tests/generated/flex/justify_content_column_flex_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_start_reverse.rs @@ -40,30 +40,164 @@ fn justify_content_column_flex_start_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node2, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_flex_start_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node2, 70f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 46f96272b..1cd2e3636 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 @@ -31,24 +31,131 @@ fn justify_content_column_max_height_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node, 180f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 180f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node00, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +198,129 @@ fn justify_content_column_max_height_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node, 180f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 180f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node00, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0baf3e3b5..00628e0b5 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 @@ -30,24 +30,131 @@ fn justify_content_column_min_height_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 150f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node00, 15f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -89,22 +196,129 @@ fn justify_content_column_min_height_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 150f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node00, 15f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 519a706b8..6e7d265c0 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 @@ -29,18 +29,86 @@ fn justify_content_column_min_height_and_margin_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn justify_content_column_min_height_and_margin_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1f1c79b72..8f0f2ba13 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 @@ -29,18 +29,86 @@ fn justify_content_column_min_height_and_margin_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn justify_content_column_min_height_and_margin_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_space_around.rs b/tests/generated/flex/justify_content_column_space_around.rs index fbb659051..608542b39 100644 --- a/tests/generated/flex/justify_content_column_space_around.rs +++ b/tests/generated/flex/justify_content_column_space_around.rs @@ -40,30 +40,164 @@ fn justify_content_column_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node2, 78f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 78f32, "y of node {:?}. Expected {}. Actual {}", node2, 78f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 78f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8005047cb..1b9fa2f07 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 @@ -71,36 +71,221 @@ fn justify_content_column_space_around_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_space_around_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0ebc2579a..5c04fd269 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 @@ -72,36 +72,221 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_space_between.rs b/tests/generated/flex/justify_content_column_space_between.rs index 3c4e638a0..b910a480e 100644 --- a/tests/generated/flex/justify_content_column_space_between.rs +++ b/tests/generated/flex/justify_content_column_space_between.rs @@ -40,30 +40,164 @@ fn justify_content_column_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 81b462b2f..db66b1ebd 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 @@ -71,36 +71,221 @@ fn justify_content_column_space_between_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_space_between_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ea01c2fce..01826212a 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 @@ -72,36 +72,221 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_space_evenly.rs b/tests/generated/flex/justify_content_column_space_evenly.rs index 788d95bb7..a7ca69d05 100644 --- a/tests/generated/flex/justify_content_column_space_evenly.rs +++ b/tests/generated/flex/justify_content_column_space_evenly.rs @@ -40,30 +40,164 @@ fn justify_content_column_space_evenly__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node2, 73f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_space_evenly__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node1, 45f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 73f32, "y of node {:?}. Expected {}. Actual {}", node2, 73f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 73f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 73f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 82e5ad725..a5f8eb5bc 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 @@ -71,36 +71,221 @@ fn justify_content_column_space_evenly_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_space_evenly_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e4794e5ae..358011b7f 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 @@ -72,36 +72,221 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_start.rs b/tests/generated/flex/justify_content_column_start.rs index 7910190d0..f1a576154 100644 --- a/tests/generated/flex/justify_content_column_start.rs +++ b/tests/generated/flex/justify_content_column_start.rs @@ -40,30 +40,164 @@ fn justify_content_column_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b6fb16916..7d232dc82 100644 --- a/tests/generated/flex/justify_content_column_start_negative_space.rs +++ b/tests/generated/flex/justify_content_column_start_negative_space.rs @@ -71,36 +71,221 @@ fn justify_content_column_start_negative_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -181,34 +366,219 @@ fn justify_content_column_start_negative_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f7e0206e8..4638ad3c8 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 @@ -72,36 +72,221 @@ fn justify_content_column_start_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node01, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node02, 160f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node02, 20f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,34 +368,219 @@ fn justify_content_column_start_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 440f32, "width of node {:?}. Expected {}. Actual {}", node, 440f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 440f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 70f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node00, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node00, 32f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node01, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node01, 32f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node01, 30f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 256f32, "width of node {:?}. Expected {}. Actual {}", node02, 256f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 32f32, "x of node {:?}. Expected {}. Actual {}", node02, 32f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node02, 60f32, location.y); + if layout.size.width != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 256f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 32f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_column_start_reverse.rs b/tests/generated/flex/justify_content_column_start_reverse.rs index 5c7ecd460..235ab085b 100644 --- a/tests/generated/flex/justify_content_column_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_start_reverse.rs @@ -40,30 +40,164 @@ fn justify_content_column_start_reverse__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +246,162 @@ fn justify_content_column_start_reverse__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_min_max.rs b/tests/generated/flex/justify_content_min_max.rs index fdb43dc69..fa150175e 100644 --- a/tests/generated/flex/justify_content_min_max.rs +++ b/tests/generated/flex/justify_content_min_max.rs @@ -30,18 +30,86 @@ fn justify_content_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn justify_content_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 053a1b731..b8ed11066 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 @@ -55,30 +55,200 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__borde println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1000f32, "width of node {:?}. Expected {}. Actual {}", node, 1000f32, size.width); - assert_eq!(size.height, 1584f32, "height of node {:?}. Expected {}. Actual {}", node, 1584f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1000f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1000f32, layout.size.width); + } + if layout.size.height != 1584f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 1584f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1000f32, "width of node {:?}. Expected {}. Actual {}", node0, 1000f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1000f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1000f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node00, 500f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node000, 300f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node000, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 300f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(location.x), + 100f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -145,28 +315,198 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__conte println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1000f32, "width of node {:?}. Expected {}. Actual {}", node, 1000f32, size.width); - assert_eq!(size.height, 1584f32, "height of node {:?}. Expected {}. Actual {}", node, 1584f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1000f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1000f32, layout.size.width); + } + if layout.size.height != 1584f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 1584f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1000f32, "width of node {:?}. Expected {}. Actual {}", node0, 1000f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1000f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1000f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node00, 600f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node000, 300f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node000, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 300f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(location.x), + 150f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5fbfee82e..7b1315b20 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 @@ -55,30 +55,200 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__border_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); - assert_eq!(size.height, 1584f32, "height of node {:?}. Expected {}. Actual {}", node, 1584f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 1584f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 1584f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node0, 1080f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node00, 400f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 199f32, "width of node {:?}. Expected {}. Actual {}", node000, 199f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 101f32, "x of node {:?}. Expected {}. Actual {}", node000, 101f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 199f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 199f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 101f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(location.x), + 101f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -145,28 +315,198 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__content println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node, 1080f32, size.width); - assert_eq!(size.height, 1584f32, "height of node {:?}. Expected {}. Actual {}", node, 1584f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 1584f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 1584f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1080f32, "width of node {:?}. Expected {}. Actual {}", node0, 1080f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 1080f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 1080f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node00, 600f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 199f32, "width of node {:?}. Expected {}. Actual {}", node000, 199f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node000, 100f32, size.height); - assert_eq!(location.x, 201f32, "x of node {:?}. Expected {}. Actual {}", node000, 201f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 199f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.width), + 199f32, + layout.size.width + ); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 201f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(location.x), + 201f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_overflow_min_max.rs b/tests/generated/flex/justify_content_overflow_min_max.rs index 233e07fb4..8e3b09f8f 100644 --- a/tests/generated/flex/justify_content_overflow_min_max.rs +++ b/tests/generated/flex/justify_content_overflow_min_max.rs @@ -50,30 +50,164 @@ fn justify_content_overflow_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 110f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node0, -20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -132,28 +266,162 @@ fn justify_content_overflow_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 110f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node0, -20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_center.rs b/tests/generated/flex/justify_content_row_center.rs index 649e3f523..fc056d91c 100644 --- a/tests/generated/flex/justify_content_row_center.rs +++ b/tests/generated/flex/justify_content_row_center.rs @@ -39,30 +39,182 @@ fn justify_content_row_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node0, 35f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node2, 55f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn justify_content_row_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node0, 35f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node2, 55f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_flex_end.rs b/tests/generated/flex/justify_content_row_flex_end.rs index 175ad1575..fe2362e3a 100644 --- a/tests/generated/flex/justify_content_row_flex_end.rs +++ b/tests/generated/flex/justify_content_row_flex_end.rs @@ -39,30 +39,182 @@ fn justify_content_row_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn justify_content_row_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_flex_start.rs b/tests/generated/flex/justify_content_row_flex_start.rs index 7ab55be57..c8af0ed6b 100644 --- a/tests/generated/flex/justify_content_row_flex_start.rs +++ b/tests/generated/flex/justify_content_row_flex_start.rs @@ -39,30 +39,182 @@ fn justify_content_row_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn justify_content_row_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0ca8300a1..6630dc4b0 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 @@ -29,18 +29,86 @@ fn justify_content_row_max_width_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn justify_content_row_max_width_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2bf6f41f6..f56f9abd6 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 @@ -28,18 +28,86 @@ fn justify_content_row_min_width_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn justify_content_row_min_width_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_space_around.rs b/tests/generated/flex/justify_content_row_space_around.rs index 3cf9ae337..29ffbc749 100644 --- a/tests/generated/flex/justify_content_row_space_around.rs +++ b/tests/generated/flex/justify_content_row_space_around.rs @@ -39,30 +39,182 @@ fn justify_content_row_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node0, 12f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 78f32, "x of node {:?}. Expected {}. Actual {}", node2, 78f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 78f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn justify_content_row_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node0, 12f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 78f32, "x of node {:?}. Expected {}. Actual {}", node2, 78f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 78f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 78f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_space_between.rs b/tests/generated/flex/justify_content_row_space_between.rs index 44f01f902..dcb4fc400 100644 --- a/tests/generated/flex/justify_content_row_space_between.rs +++ b/tests/generated/flex/justify_content_row_space_between.rs @@ -39,30 +39,182 @@ fn justify_content_row_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +262,180 @@ fn justify_content_row_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node1, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/justify_content_row_space_evenly.rs b/tests/generated/flex/justify_content_row_space_evenly.rs index e9e5d5f64..2cede727f 100644 --- a/tests/generated/flex/justify_content_row_space_evenly.rs +++ b/tests/generated/flex/justify_content_row_space_evenly.rs @@ -39,30 +39,164 @@ fn justify_content_row_space_evenly__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,28 +244,162 @@ fn justify_content_row_space_evenly__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node0, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_and_flex_column.rs b/tests/generated/flex/margin_and_flex_column.rs index 6dcfefd55..c3d27a57f 100644 --- a/tests/generated/flex/margin_and_flex_column.rs +++ b/tests/generated/flex/margin_and_flex_column.rs @@ -28,18 +28,86 @@ fn margin_and_flex_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn margin_and_flex_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_and_flex_row.rs b/tests/generated/flex/margin_and_flex_row.rs index e4f7d56e8..2b463aad8 100644 --- a/tests/generated/flex/margin_and_flex_row.rs +++ b/tests/generated/flex/margin_and_flex_row.rs @@ -27,18 +27,92 @@ fn margin_and_flex_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +146,90 @@ fn margin_and_flex_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_and_stretch_column.rs b/tests/generated/flex/margin_and_stretch_column.rs index 1ec4478fd..075517317 100644 --- a/tests/generated/flex/margin_and_stretch_column.rs +++ b/tests/generated/flex/margin_and_stretch_column.rs @@ -28,18 +28,92 @@ fn margin_and_stretch_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +148,90 @@ fn margin_and_stretch_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_and_stretch_row.rs b/tests/generated/flex/margin_and_stretch_row.rs index 84b70771c..deecca1a0 100644 --- a/tests/generated/flex/margin_and_stretch_row.rs +++ b/tests/generated/flex/margin_and_stretch_row.rs @@ -27,18 +27,86 @@ fn margin_and_stretch_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +140,84 @@ fn margin_and_stretch_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_bottom.rs b/tests/generated/flex/margin_auto_bottom.rs index 945829909..2849563b5 100644 --- a/tests/generated/flex/margin_auto_bottom.rs +++ b/tests/generated/flex/margin_auto_bottom.rs @@ -45,24 +45,125 @@ fn margin_auto_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_bottom_and_top.rs b/tests/generated/flex/margin_auto_bottom_and_top.rs index b459cc9b6..4b604de93 100644 --- a/tests/generated/flex/margin_auto_bottom_and_top.rs +++ b/tests/generated/flex/margin_auto_bottom_and_top.rs @@ -45,24 +45,125 @@ fn margin_auto_bottom_and_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_bottom_and_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2f2f75357..cb17adf25 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 @@ -45,24 +45,125 @@ fn margin_auto_bottom_and_top_justify_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_bottom_and_top_justify_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_left.rs b/tests/generated/flex/margin_auto_left.rs index f9331dbcc..3af33b682 100644 --- a/tests/generated/flex/margin_auto_left.rs +++ b/tests/generated/flex/margin_auto_left.rs @@ -45,24 +45,125 @@ fn margin_auto_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_left_and_right.rs b/tests/generated/flex/margin_auto_left_and_right.rs index ceb13b5ae..639a054fa 100644 --- a/tests/generated/flex/margin_auto_left_and_right.rs +++ b/tests/generated/flex/margin_auto_left_and_right.rs @@ -44,24 +44,125 @@ fn margin_auto_left_and_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -113,22 +214,123 @@ fn margin_auto_left_and_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 57692212d..d00900baa 100644 --- a/tests/generated/flex/margin_auto_left_and_right_column.rs +++ b/tests/generated/flex/margin_auto_left_and_right_column.rs @@ -45,24 +45,125 @@ fn margin_auto_left_and_right_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_left_and_right_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 526f1b6d7..8c7ab7f92 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 @@ -45,24 +45,125 @@ fn margin_auto_left_and_right_column_and_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_left_and_right_column_and_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 452add0f5..321db2f48 100644 --- a/tests/generated/flex/margin_auto_left_and_right_stretch.rs +++ b/tests/generated/flex/margin_auto_left_and_right_stretch.rs @@ -45,24 +45,125 @@ fn margin_auto_left_and_right_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_left_and_right_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 469fcfb22..a31428287 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 @@ -36,18 +36,86 @@ fn margin_auto_left_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn margin_auto_left_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 15991e421..30fb6a41c 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 @@ -36,18 +36,86 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 42f32, "width of node {:?}. Expected {}. Actual {}", node0, 42f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 42f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 42f32, "width of node {:?}. Expected {}. Actual {}", node0, 42f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 42f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2111ba453..800020292 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 @@ -36,18 +36,86 @@ fn margin_auto_left_right_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn margin_auto_left_right_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_left_stretching_child.rs b/tests/generated/flex/margin_auto_left_stretching_child.rs index c0199a749..333575d72 100644 --- a/tests/generated/flex/margin_auto_left_stretching_child.rs +++ b/tests/generated/flex/margin_auto_left_stretching_child.rs @@ -44,24 +44,125 @@ fn margin_auto_left_stretching_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node0, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -113,22 +214,123 @@ fn margin_auto_left_stretching_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node0, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_multiple_children_column.rs b/tests/generated/flex/margin_auto_multiple_children_column.rs index 46f112abe..26eb7cd3c 100644 --- a/tests/generated/flex/margin_auto_multiple_children_column.rs +++ b/tests/generated/flex/margin_auto_multiple_children_column.rs @@ -61,30 +61,164 @@ fn margin_auto_multiple_children_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node0, 75f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node0, 25f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node2, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -154,28 +288,162 @@ fn margin_auto_multiple_children_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node0, 75f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node0, 25f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node2, 75f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node2, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_multiple_children_row.rs b/tests/generated/flex/margin_auto_multiple_children_row.rs index c40b70ac8..a110b9a86 100644 --- a/tests/generated/flex/margin_auto_multiple_children_row.rs +++ b/tests/generated/flex/margin_auto_multiple_children_row.rs @@ -60,30 +60,164 @@ fn margin_auto_multiple_children_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node2, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node2, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,28 +286,162 @@ fn margin_auto_multiple_children_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 75f32, "x of node {:?}. Expected {}. Actual {}", node1, 75f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 75f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node2, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node2, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_right.rs b/tests/generated/flex/margin_auto_right.rs index 5ef8008c0..180357372 100644 --- a/tests/generated/flex/margin_auto_right.rs +++ b/tests/generated/flex/margin_auto_right.rs @@ -45,24 +45,125 @@ fn margin_auto_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_top.rs b/tests/generated/flex/margin_auto_top.rs index 8205e394d..a06ec207d 100644 --- a/tests/generated/flex/margin_auto_top.rs +++ b/tests/generated/flex/margin_auto_top.rs @@ -45,24 +45,125 @@ fn margin_auto_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node0, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn margin_auto_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node0, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1e35061fd..e8e9c6da3 100644 --- a/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs +++ b/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs @@ -46,24 +46,125 @@ fn margin_auto_top_and_bottom_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node1, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn margin_auto_top_and_bottom_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node0, 50f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node1, 150f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_auto_top_stretching_child.rs b/tests/generated/flex/margin_auto_top_stretching_child.rs index 5074f0577..43c1f80f0 100644 --- a/tests/generated/flex/margin_auto_top_stretching_child.rs +++ b/tests/generated/flex/margin_auto_top_stretching_child.rs @@ -44,24 +44,125 @@ fn margin_auto_top_stretching_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node0, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node0, 200f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -113,22 +214,123 @@ fn margin_auto_top_stretching_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node0, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node0, 200f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 150f32, "x of node {:?}. Expected {}. Actual {}", node1, 150f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node1, 75f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 150f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_bottom.rs b/tests/generated/flex/margin_bottom.rs index d97367f8c..0f0f32490 100644 --- a/tests/generated/flex/margin_bottom.rs +++ b/tests/generated/flex/margin_bottom.rs @@ -29,18 +29,86 @@ fn margin_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn margin_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1bf409d36..ed75ec8d9 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 @@ -36,18 +36,86 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 42f32, "width of node {:?}. Expected {}. Actual {}", node0, 42f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 42f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +158,84 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 42f32, "width of node {:?}. Expected {}. Actual {}", node0, 42f32, size.width); - assert_eq!(size.height, 72f32, "height of node {:?}. Expected {}. Actual {}", node0, 72f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 42f32, layout.size.width); + } + if layout.size.height != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 72f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_left.rs b/tests/generated/flex/margin_left.rs index fadc4dbc8..5146b3882 100644 --- a/tests/generated/flex/margin_left.rs +++ b/tests/generated/flex/margin_left.rs @@ -27,18 +27,92 @@ fn margin_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +146,90 @@ fn margin_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_right.rs b/tests/generated/flex/margin_right.rs index 8b2bdbaa3..e4a2cd79c 100644 --- a/tests/generated/flex/margin_right.rs +++ b/tests/generated/flex/margin_right.rs @@ -28,18 +28,92 @@ fn margin_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +148,90 @@ fn margin_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7952bcaaf..113bf3343 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 @@ -31,18 +31,92 @@ fn margin_should_not_be_part_of_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 250f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +154,90 @@ fn margin_should_not_be_part_of_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 250f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7a4f02a56..415a48f57 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 @@ -31,18 +31,92 @@ fn margin_should_not_be_part_of_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 250f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +154,90 @@ fn margin_should_not_be_part_of_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 250f32, "width of node {:?}. Expected {}. Actual {}", node, 250f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 250f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 250f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_top.rs b/tests/generated/flex/margin_top.rs index 7e67e47f8..70e0344be 100644 --- a/tests/generated/flex/margin_top.rs +++ b/tests/generated/flex/margin_top.rs @@ -28,18 +28,86 @@ fn margin_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn margin_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_with_sibling_column.rs b/tests/generated/flex/margin_with_sibling_column.rs index d2a1b59ca..cdd598aec 100644 --- a/tests/generated/flex/margin_with_sibling_column.rs +++ b/tests/generated/flex/margin_with_sibling_column.rs @@ -29,24 +29,125 @@ fn margin_with_sibling_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node0, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node1, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node1, 55f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,22 +189,123 @@ fn margin_with_sibling_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node0, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node1, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node1, 55f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/margin_with_sibling_row.rs b/tests/generated/flex/margin_with_sibling_row.rs index a221f9b3e..ac799cdb7 100644 --- a/tests/generated/flex/margin_with_sibling_row.rs +++ b/tests/generated/flex/margin_with_sibling_row.rs @@ -28,24 +28,137 @@ fn margin_with_sibling_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node0, 45f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node1, 45f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node1, 55f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +199,135 @@ fn margin_with_sibling_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node0, 45f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node1, 45f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node1, 55f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/max_height.rs b/tests/generated/flex/max_height.rs index adb13ccad..9f8747359 100644 --- a/tests/generated/flex/max_height.rs +++ b/tests/generated/flex/max_height.rs @@ -27,18 +27,86 @@ fn max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +140,84 @@ fn max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/max_height_overrides_height.rs b/tests/generated/flex/max_height_overrides_height.rs index d4a19ff92..db5c037e6 100644 --- a/tests/generated/flex/max_height_overrides_height.rs +++ b/tests/generated/flex/max_height_overrides_height.rs @@ -16,18 +16,92 @@ fn max_height_overrides_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +128,90 @@ fn max_height_overrides_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ef52ded63..f34361c03 100644 --- a/tests/generated/flex/max_height_overrides_height_on_root.rs +++ b/tests/generated/flex/max_height_overrides_height_on_root.rs @@ -15,12 +15,47 @@ fn max_height_overrides_height_on_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -41,10 +76,45 @@ fn max_height_overrides_height_on_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/max_width.rs b/tests/generated/flex/max_width.rs index 2d7981f3e..47367bfec 100644 --- a/tests/generated/flex/max_width.rs +++ b/tests/generated/flex/max_width.rs @@ -28,18 +28,86 @@ fn max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/max_width_overrides_width.rs b/tests/generated/flex/max_width_overrides_width.rs index b3a4cc5a6..47fb26b86 100644 --- a/tests/generated/flex/max_width_overrides_width.rs +++ b/tests/generated/flex/max_width_overrides_width.rs @@ -16,18 +16,86 @@ fn max_width_overrides_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +122,84 @@ fn max_width_overrides_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 67544bf9c..94d6af66a 100644 --- a/tests/generated/flex/max_width_overrides_width_on_root.rs +++ b/tests/generated/flex/max_width_overrides_width_on_root.rs @@ -15,12 +15,47 @@ fn max_width_overrides_width_on_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -41,10 +76,45 @@ fn max_width_overrides_width_on_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child.rs b/tests/generated/flex/measure_child.rs index 9830fd54b..531e9dfe3 100644 --- a/tests/generated/flex/measure_child.rs +++ b/tests/generated/flex/measure_child.rs @@ -15,18 +15,86 @@ fn measure_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -51,16 +119,84 @@ fn measure_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child_absolute.rs b/tests/generated/flex/measure_child_absolute.rs index b21457532..b422c12b7 100644 --- a/tests/generated/flex/measure_child_absolute.rs +++ b/tests/generated/flex/measure_child_absolute.rs @@ -26,18 +26,86 @@ fn measure_child_absolute__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -73,16 +141,84 @@ fn measure_child_absolute__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child_constraint.rs b/tests/generated/flex/measure_child_constraint.rs index e423669f9..6abdacafc 100644 --- a/tests/generated/flex/measure_child_constraint.rs +++ b/tests/generated/flex/measure_child_constraint.rs @@ -4,7 +4,13 @@ fn measure_child_constraint__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = "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" ; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -21,18 +27,92 @@ fn measure_child_constraint__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -41,7 +121,13 @@ fn measure_child_constraint__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = "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" ; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -59,16 +145,90 @@ fn measure_child_constraint__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child_constraint_padding_parent.rs b/tests/generated/flex/measure_child_constraint_padding_parent.rs index a533b3794..bee3f956f 100644 --- a/tests/generated/flex/measure_child_constraint_padding_parent.rs +++ b/tests/generated/flex/measure_child_constraint_padding_parent.rs @@ -4,7 +4,13 @@ fn measure_child_constraint_padding_parent__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = "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" ; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { ..Default::default() }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -27,18 +33,92 @@ fn measure_child_constraint_padding_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 60f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -47,7 +127,13 @@ fn measure_child_constraint_padding_parent__content_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy . new_leaf_with_context (taffy :: style :: Style { box_sizing : taffy :: style :: BoxSizing :: ContentBox , .. Default :: default () } , crate :: TestNodeContext :: ahem_text ("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 :: WritingMode :: Horizontal) ,) . unwrap () ; + let node0_text = "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" ; + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -71,16 +157,90 @@ fn measure_child_constraint_padding_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node, 70f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 40f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child_with_flex_grow.rs b/tests/generated/flex/measure_child_with_flex_grow.rs index d7e6860e2..c896bea5f 100644 --- a/tests/generated/flex/measure_child_with_flex_grow.rs +++ b/tests/generated/flex/measure_child_with_flex_grow.rs @@ -35,24 +35,125 @@ fn measure_child_with_flex_grow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,22 +195,123 @@ fn measure_child_with_flex_grow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_child_with_flex_shrink.rs b/tests/generated/flex/measure_child_with_flex_shrink.rs index 849b0ee65..80b6c9941 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink.rs @@ -38,24 +38,125 @@ fn measure_child_with_flex_shrink__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,22 +201,123 @@ fn measure_child_with_flex_shrink__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f36c1e959..4934f10a2 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs @@ -45,42 +45,125 @@ fn measure_child_with_flex_shrink_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node1, 91f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 9f32, "x of node {:?}. Expected {}. Actual {}", node1, 9f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 9f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 9f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 9f32, - layout.scroll_width() - ); + if layout.scroll_width() != 9f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 9f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -133,40 +216,123 @@ fn measure_child_with_flex_shrink_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node0, 9f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node1, 91f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 9f32, "x of node {:?}. Expected {}. Actual {}", node1, 9f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 9f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 9f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 9f32, - layout.scroll_width() - ); + if layout.scroll_width() != 9f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 9f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0379f73cf..33142c8d0 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 @@ -28,18 +28,86 @@ fn measure_child_with_min_size_greater_than_available_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn measure_child_with_min_size_greater_than_available_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_flex_basis_overrides_measure.rs b/tests/generated/flex/measure_flex_basis_overrides_measure.rs index 7834fb0f5..4da22439a 100644 --- a/tests/generated/flex/measure_flex_basis_overrides_measure.rs +++ b/tests/generated/flex/measure_flex_basis_overrides_measure.rs @@ -26,18 +26,86 @@ fn measure_flex_basis_overrides_measure__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn measure_flex_basis_overrides_measure__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_height_overrides_measure.rs b/tests/generated/flex/measure_height_overrides_measure.rs index d7dee7fae..934b0aab8 100644 --- a/tests/generated/flex/measure_height_overrides_measure.rs +++ b/tests/generated/flex/measure_height_overrides_measure.rs @@ -18,18 +18,86 @@ fn measure_height_overrides_measure__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node0, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -58,16 +126,84 @@ fn measure_height_overrides_measure__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node0, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 5f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_remeasure_child_after_growing.rs b/tests/generated/flex/measure_remeasure_child_after_growing.rs index 14b7dd35e..c75a697ff 100644 --- a/tests/generated/flex/measure_remeasure_child_after_growing.rs +++ b/tests/generated/flex/measure_remeasure_child_after_growing.rs @@ -36,24 +36,125 @@ fn measure_remeasure_child_after_growing__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,22 +197,123 @@ fn measure_remeasure_child_after_growing__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs index c6c8a0d22..743788801 100644 --- a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs +++ b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs @@ -37,24 +37,125 @@ fn measure_remeasure_child_after_shrinking__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -98,22 +199,123 @@ fn measure_remeasure_child_after_shrinking__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_remeasure_child_after_stretching.rs b/tests/generated/flex/measure_remeasure_child_after_stretching.rs index 0e9265ce4..134257b21 100644 --- a/tests/generated/flex/measure_remeasure_child_after_stretching.rs +++ b/tests/generated/flex/measure_remeasure_child_after_stretching.rs @@ -26,18 +26,92 @@ fn measure_remeasure_child_after_stretching__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +143,90 @@ fn measure_remeasure_child_after_stretching__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_root.rs b/tests/generated/flex/measure_root.rs index 8360be3d3..787ac8637 100644 --- a/tests/generated/flex/measure_root.rs +++ b/tests/generated/flex/measure_root.rs @@ -14,12 +14,47 @@ fn measure_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -38,10 +73,45 @@ fn measure_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_stretch_overrides_measure.rs b/tests/generated/flex/measure_stretch_overrides_measure.rs index a941f8d65..23ed57d6c 100644 --- a/tests/generated/flex/measure_stretch_overrides_measure.rs +++ b/tests/generated/flex/measure_stretch_overrides_measure.rs @@ -37,24 +37,125 @@ fn measure_stretch_overrides_measure__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +200,123 @@ fn measure_stretch_overrides_measure__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/measure_width_overrides_measure.rs b/tests/generated/flex/measure_width_overrides_measure.rs index 6f52fd321..d97be8f45 100644 --- a/tests/generated/flex/measure_width_overrides_measure.rs +++ b/tests/generated/flex/measure_width_overrides_measure.rs @@ -18,18 +18,86 @@ fn measure_width_overrides_measure__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -58,16 +126,84 @@ fn measure_width_overrides_measure__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_height.rs b/tests/generated/flex/min_height.rs index 781c78ea8..83b87433c 100644 --- a/tests/generated/flex/min_height.rs +++ b/tests/generated/flex/min_height.rs @@ -29,24 +29,125 @@ fn min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,22 +189,123 @@ fn min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_height_larger_than_height.rs b/tests/generated/flex/min_height_larger_than_height.rs index 2125425cf..2243f62b7 100644 --- a/tests/generated/flex/min_height_larger_than_height.rs +++ b/tests/generated/flex/min_height_larger_than_height.rs @@ -27,18 +27,86 @@ fn min_height_larger_than_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +140,84 @@ fn min_height_larger_than_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_height_overrides_height.rs b/tests/generated/flex/min_height_overrides_height.rs index 8c6b5ea93..e1dcad6bc 100644 --- a/tests/generated/flex/min_height_overrides_height.rs +++ b/tests/generated/flex/min_height_overrides_height.rs @@ -16,18 +16,92 @@ fn min_height_overrides_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +128,90 @@ fn min_height_overrides_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d3958c984..de20777f1 100644 --- a/tests/generated/flex/min_height_overrides_height_on_root.rs +++ b/tests/generated/flex/min_height_overrides_height_on_root.rs @@ -15,12 +15,47 @@ fn min_height_overrides_height_on_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -41,10 +76,45 @@ fn min_height_overrides_height_on_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_height_overrides_max_height.rs b/tests/generated/flex/min_height_overrides_max_height.rs index 344ebf37f..c76053201 100644 --- a/tests/generated/flex/min_height_overrides_max_height.rs +++ b/tests/generated/flex/min_height_overrides_max_height.rs @@ -16,18 +16,92 @@ fn min_height_overrides_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +128,90 @@ fn min_height_overrides_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e6c871431..35294c777 100644 --- a/tests/generated/flex/min_height_with_nested_fixed_height.rs +++ b/tests/generated/flex/min_height_with_nested_fixed_height.rs @@ -46,24 +46,131 @@ fn min_height_with_nested_fixed_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 57f32, "height of node {:?}. Expected {}. Actual {}", node, 57f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 57f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 57f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 16f32, "x of node {:?}. Expected {}. Actual {}", node0, 16f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 16f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +224,129 @@ fn min_height_with_nested_fixed_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 352f32, "width of node {:?}. Expected {}. Actual {}", node, 352f32, size.width); - assert_eq!(size.height, 57f32, "height of node {:?}. Expected {}. Actual {}", node, 57f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 352f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 352f32, layout.size.width); + } + if layout.size.height != 57f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 57f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 16f32, "x of node {:?}. Expected {}. Actual {}", node0, 16f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 16f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a67f50604..edbb321e8 100644 --- a/tests/generated/flex/min_max_percent_different_width_height.rs +++ b/tests/generated/flex/min_max_percent_different_width_height.rs @@ -38,18 +38,86 @@ fn min_max_percent_different_width_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn min_max_percent_different_width_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 35bd30c2f..dc237deda 100644 --- a/tests/generated/flex/min_max_percent_no_width_height.rs +++ b/tests/generated/flex/min_max_percent_no_width_height.rs @@ -35,18 +35,86 @@ fn min_max_percent_no_width_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn min_max_percent_no_width_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_width.rs b/tests/generated/flex/min_width.rs index 602d6c03f..64313675c 100644 --- a/tests/generated/flex/min_width.rs +++ b/tests/generated/flex/min_width.rs @@ -28,24 +28,137 @@ fn min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +199,135 @@ fn min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_width_larger_than_width.rs b/tests/generated/flex/min_width_larger_than_width.rs index 5d31345b5..ae74676e6 100644 --- a/tests/generated/flex/min_width_larger_than_width.rs +++ b/tests/generated/flex/min_width_larger_than_width.rs @@ -28,18 +28,86 @@ fn min_width_larger_than_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn min_width_larger_than_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_width_overrides_max_width.rs b/tests/generated/flex/min_width_overrides_max_width.rs index 9d26b3c6c..8705c5690 100644 --- a/tests/generated/flex/min_width_overrides_max_width.rs +++ b/tests/generated/flex/min_width_overrides_max_width.rs @@ -16,18 +16,86 @@ fn min_width_overrides_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +122,84 @@ fn min_width_overrides_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/min_width_overrides_width.rs b/tests/generated/flex/min_width_overrides_width.rs index 4084f78e6..f396f622f 100644 --- a/tests/generated/flex/min_width_overrides_width.rs +++ b/tests/generated/flex/min_width_overrides_width.rs @@ -16,18 +16,86 @@ fn min_width_overrides_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -54,16 +122,84 @@ fn min_width_overrides_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e8255eac1..5cfa3a911 100644 --- a/tests/generated/flex/min_width_overrides_width_on_root.rs +++ b/tests/generated/flex/min_width_overrides_width_on_root.rs @@ -15,12 +15,47 @@ fn min_width_overrides_width_on_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -41,10 +76,45 @@ fn min_width_overrides_width_on_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/mod.rs b/tests/generated/flex/mod.rs index 2da7e914e..ce63118a1 100644 --- a/tests/generated/flex/mod.rs +++ b/tests/generated/flex/mod.rs @@ -204,6 +204,7 @@ mod child_min_max_width_flexing; mod child_with_padding_align_end; mod container_with_unsized_child; mod content_size; +mod content_size_with_border; mod display_none; mod display_none_absolute_child; mod display_none_fixed_size; @@ -213,6 +214,10 @@ mod display_none_with_margin; mod display_none_with_position; mod display_none_with_position_absolute; mod do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent; +mod flex_absolute_overflow_clip; +mod flex_absolute_overflow_hidden; +mod flex_absolute_overflow_scroll; +mod flex_absolute_overflow_visible; mod flex_basis_and_main_dimen_set_when_flexing; mod flex_basis_flex_grow_column; mod flex_basis_flex_grow_row; @@ -257,6 +262,10 @@ mod flex_grow_within_constrained_min_column; mod flex_grow_within_constrained_min_max_column; mod flex_grow_within_constrained_min_row; mod flex_grow_within_max_width; +mod flex_inflow_overflow_clip; +mod flex_inflow_overflow_hidden; +mod flex_inflow_overflow_scroll; +mod flex_inflow_overflow_visible; mod flex_root_ignored; mod flex_row_relative_all_sides; mod flex_shrink_by_outer_margin_with_max_size; diff --git a/tests/generated/flex/multiline_column_max_height.rs b/tests/generated/flex/multiline_column_max_height.rs index 6f3899eaf..1e623a9cd 100644 --- a/tests/generated/flex/multiline_column_max_height.rs +++ b/tests/generated/flex/multiline_column_max_height.rs @@ -223,132 +223,887 @@ fn multiline_column_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node5, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node7, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node9, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node9, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node9, 0f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node9, 180f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node10, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node10, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node11, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node11, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node12, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node12, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node13, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node13, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node13, 40f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node13, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node14, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node14, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node14, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node14, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node15, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node15, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node15, 40f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node15, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node16).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node16, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node16, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node16, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node16, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node17).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node17, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node17, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node17, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node17, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node18).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node18, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node18, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node18, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node18, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node19).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node19, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node19, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node19, 40f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node19, 180f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -597,130 +1352,885 @@ fn multiline_column_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node5, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node7, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node9, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node9, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node9, 0f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node9, 180f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node10, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node10, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node11, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node11, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node11, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node12, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node12, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node13, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node13, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node13, 40f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node13, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node14, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node14, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node14, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node14, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node15, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node15, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node15, 40f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node15, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node16).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node16, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node16, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node16, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node16, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node16, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node16, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node17).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node17, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node17, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node17, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node17, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node17, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node17, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node18).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node18, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node18, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node18, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node18, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node18, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node18, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node19).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node19, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node19, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node19, 40f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node19, 180f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node19, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node19, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/multiline_min_max_12.rs b/tests/generated/flex/multiline_min_max_12.rs index 24787efc8..cb68743da 100644 --- a/tests/generated/flex/multiline_min_max_12.rs +++ b/tests/generated/flex/multiline_min_max_12.rs @@ -76,36 +76,203 @@ fn multiline_min_max_12__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -186,34 +353,201 @@ fn multiline_min_max_12__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/multiline_min_max_13.rs b/tests/generated/flex/multiline_min_max_13.rs index f64357181..1eb01e850 100644 --- a/tests/generated/flex/multiline_min_max_13.rs +++ b/tests/generated/flex/multiline_min_max_13.rs @@ -76,36 +76,203 @@ fn multiline_min_max_13__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -186,34 +353,201 @@ fn multiline_min_max_13__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/multiline_min_max_14.rs b/tests/generated/flex/multiline_min_max_14.rs index f8baf2e25..51ec785d0 100644 --- a/tests/generated/flex/multiline_min_max_14.rs +++ b/tests/generated/flex/multiline_min_max_14.rs @@ -76,36 +76,203 @@ fn multiline_min_max_14__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node1, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 315f32, "x of node {:?}. Expected {}. Actual {}", node1, 315f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 315f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 315f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node2, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 460f32, "x of node {:?}. Expected {}. Actual {}", node2, 460f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 460f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 460f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node3, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node3, 15f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -186,34 +353,201 @@ fn multiline_min_max_14__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node1, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 315f32, "x of node {:?}. Expected {}. Actual {}", node1, 315f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 315f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 315f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node2, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 460f32, "x of node {:?}. Expected {}. Actual {}", node2, 460f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 460f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 460f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node3, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node3, 15f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/multiline_min_max_5.rs b/tests/generated/flex/multiline_min_max_5.rs index 94ea90a4a..b4f980e2c 100644 --- a/tests/generated/flex/multiline_min_max_5.rs +++ b/tests/generated/flex/multiline_min_max_5.rs @@ -79,36 +79,203 @@ fn multiline_min_max_5__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -192,34 +359,201 @@ fn multiline_min_max_5__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 305f32, "x of node {:?}. Expected {}. Actual {}", node1, 305f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 305f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 305f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 405f32, "x of node {:?}. Expected {}. Actual {}", node2, 405f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 405f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 405f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 505f32, "x of node {:?}. Expected {}. Actual {}", node3, 505f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node3, 5f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 505f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 505f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/multiline_min_max_8.rs b/tests/generated/flex/multiline_min_max_8.rs index 22e2aad10..d64a776f1 100644 --- a/tests/generated/flex/multiline_min_max_8.rs +++ b/tests/generated/flex/multiline_min_max_8.rs @@ -76,36 +76,203 @@ fn multiline_min_max_8__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node1, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 315f32, "x of node {:?}. Expected {}. Actual {}", node1, 315f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 315f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 315f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node2, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 460f32, "x of node {:?}. Expected {}. Actual {}", node2, 460f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 460f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 460f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node3, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node3, 15f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -190,34 +357,201 @@ fn multiline_min_max_8__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 610f32, "width of node {:?}. Expected {}. Actual {}", node, 610f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 610f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 610f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node0, 300f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node1, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 315f32, "x of node {:?}. Expected {}. Actual {}", node1, 315f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 315f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 315f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node2, 145f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 460f32, "x of node {:?}. Expected {}. Actual {}", node2, 460f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node2, 5f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 460f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 460f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 600f32, "width of node {:?}. Expected {}. Actual {}", node3, 600f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node3, 15f32, location.y); + if layout.size.width != 600f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 600f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/nested_overflowing_child.rs b/tests/generated/flex/nested_overflowing_child.rs index a073fbf33..99265e7e0 100644 --- a/tests/generated/flex/nested_overflowing_child.rs +++ b/tests/generated/flex/nested_overflowing_child.rs @@ -30,24 +30,137 @@ fn nested_overflowing_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -89,22 +202,135 @@ fn nested_overflowing_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cfd2c9732..4540ddff6 100644 --- a/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs +++ b/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs @@ -41,24 +41,137 @@ fn nested_overflowing_child_in_constraint_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -107,22 +220,135 @@ fn nested_overflowing_child_in_constraint_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7940dfb7b..694602fad 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 @@ -41,30 +41,170 @@ fn only_shrinkable_item_with_flex_basis_zero__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node, 480f32, size.width); - assert_eq!(size.height, 764f32, "height of node {:?}. Expected {}. Actual {}", node, 764f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 764f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 764f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 99f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 99f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node0, 480f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node1, 480f32, size.width); - assert_eq!(size.height, 93f32, "height of node {:?}. Expected {}. Actual {}", node1, 93f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 93f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 93f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node2, 480f32, size.width); - assert_eq!(size.height, 764f32, "height of node {:?}. Expected {}. Actual {}", node2, 764f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 99f32, "y of node {:?}. Expected {}. Actual {}", node2, 99f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 764f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 764f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 99f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -114,28 +254,168 @@ fn only_shrinkable_item_with_flex_basis_zero__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node, 480f32, size.width); - assert_eq!(size.height, 764f32, "height of node {:?}. Expected {}. Actual {}", node, 764f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 764f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 764f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 99f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 99f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node0, 480f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node1, 480f32, size.width); - assert_eq!(size.height, 93f32, "height of node {:?}. Expected {}. Actual {}", node1, 93f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 93f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 93f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 480f32, "width of node {:?}. Expected {}. Actual {}", node2, 480f32, size.width); - assert_eq!(size.height, 764f32, "height of node {:?}. Expected {}. Actual {}", node2, 764f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 99f32, "y of node {:?}. Expected {}. Actual {}", node2, 99f32, location.y); + if layout.size.width != 480f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 480f32, layout.size.width); + } + if layout.size.height != 764f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 764f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 99f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_cross_axis.rs b/tests/generated/flex/overflow_cross_axis.rs index 51dafb5af..ea0d15559 100644 --- a/tests/generated/flex/overflow_cross_axis.rs +++ b/tests/generated/flex/overflow_cross_axis.rs @@ -29,18 +29,92 @@ fn overflow_cross_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +150,90 @@ fn overflow_cross_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_main_axis.rs b/tests/generated/flex/overflow_main_axis.rs index 448105755..7817c98f3 100644 --- a/tests/generated/flex/overflow_main_axis.rs +++ b/tests/generated/flex/overflow_main_axis.rs @@ -27,18 +27,92 @@ fn overflow_main_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -72,16 +146,90 @@ fn overflow_main_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 100f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs index 42170a0f4..fde71a862 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs @@ -34,36 +34,86 @@ fn overflow_main_axis_shrink_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,34 +154,84 @@ fn overflow_main_axis_shrink_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs index 5de6c7913..4ee69d2e3 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs @@ -34,36 +34,86 @@ fn overflow_main_axis_shrink_scroll__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,34 +154,84 @@ fn overflow_main_axis_shrink_scroll__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_main_axis_shrink_visible.rs b/tests/generated/flex/overflow_main_axis_shrink_visible.rs index e589a1ad0..8e4bf3df7 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_visible.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_visible.rs @@ -26,18 +26,86 @@ fn overflow_main_axis_shrink_visible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -73,16 +141,84 @@ fn overflow_main_axis_shrink_visible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bb6b77a1b..74bafaa91 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 @@ -28,18 +28,92 @@ fn overflow_scroll_main_axis_justify_content_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, -100f32, "x of node {:?}. Expected {}. Actual {}", node0, -100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +148,90 @@ fn overflow_scroll_main_axis_justify_content_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, -100f32, "x of node {:?}. Expected {}. Actual {}", node0, -100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs index b4291b2a9..3d0942d6a 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs @@ -35,42 +35,125 @@ fn overflow_scrollbars_overridden_by_available_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,40 +201,123 @@ fn overflow_scrollbars_overridden_by_available_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs index 5a994e0e1..58fa2fffb 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs @@ -26,36 +26,86 @@ fn overflow_scrollbars_overridden_by_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,34 +143,84 @@ fn overflow_scrollbars_overridden_by_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs index 36ee9e94b..67c88b423 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs @@ -26,36 +26,86 @@ fn overflow_scrollbars_overridden_by_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,34 +143,84 @@ fn overflow_scrollbars_overridden_by_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 01d51183e..55d5e5387 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 @@ -26,36 +26,86 @@ fn overflow_scrollbars_take_up_space_both_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,34 +143,84 @@ fn overflow_scrollbars_take_up_space_both_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e54e063c3..96729dea2 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 @@ -26,36 +26,86 @@ fn overflow_scrollbars_take_up_space_cross_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,34 +143,84 @@ fn overflow_scrollbars_take_up_space_cross_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d424affbf..81aaf299d 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 @@ -26,36 +26,86 @@ fn overflow_scrollbars_take_up_space_main_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,34 +143,84 @@ fn overflow_scrollbars_take_up_space_main_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_align_end_child.rs b/tests/generated/flex/padding_align_end_child.rs index c4127e7ac..689db2471 100644 --- a/tests/generated/flex/padding_align_end_child.rs +++ b/tests/generated/flex/padding_align_end_child.rs @@ -37,18 +37,92 @@ fn padding_align_end_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +166,90 @@ fn padding_align_end_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_border_overrides_max_size.rs b/tests/generated/flex/padding_border_overrides_max_size.rs index 7ab96f984..74e52c6c3 100644 --- a/tests/generated/flex/padding_border_overrides_max_size.rs +++ b/tests/generated/flex/padding_border_overrides_max_size.rs @@ -30,18 +30,86 @@ fn padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_border_overrides_min_size.rs b/tests/generated/flex/padding_border_overrides_min_size.rs index 776e123af..e7892e101 100644 --- a/tests/generated/flex/padding_border_overrides_min_size.rs +++ b/tests/generated/flex/padding_border_overrides_min_size.rs @@ -30,18 +30,86 @@ fn padding_border_overrides_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn padding_border_overrides_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_border_overrides_size.rs b/tests/generated/flex/padding_border_overrides_size.rs index 7e73f40fb..fce483721 100644 --- a/tests/generated/flex/padding_border_overrides_size.rs +++ b/tests/generated/flex/padding_border_overrides_size.rs @@ -30,18 +30,86 @@ fn padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 12912b0e8..b1ed694f0 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 @@ -43,24 +43,125 @@ fn padding_border_overrides_size_flex_basis_0_growable__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node0, 28f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 6f32, "width of node {:?}. Expected {}. Actual {}", node1, 6f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node1, 12f32, size.height); - assert_eq!(location.x, 28f32, "x of node {:?}. Expected {}. Actual {}", node1, 28f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 6f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 28f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +216,123 @@ fn padding_border_overrides_size_flex_basis_0_growable__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 46f32, "width of node {:?}. Expected {}. Actual {}", node, 46f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 46f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 46f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node1, 12f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node1, 12f32, size.height); - assert_eq!(location.x, 34f32, "x of node {:?}. Expected {}. Actual {}", node1, 34f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 34f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_border_overrides_size_root.rs b/tests/generated/flex/padding_border_overrides_size_root.rs index ce7a771c5..0c09e65c3 100644 --- a/tests/generated/flex/padding_border_overrides_size_root.rs +++ b/tests/generated/flex/padding_border_overrides_size_root.rs @@ -33,18 +33,86 @@ fn padding_border_overrides_size_root__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -85,16 +153,84 @@ fn padding_border_overrides_size_root__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_center_child.rs b/tests/generated/flex/padding_center_child.rs index 046cf43c6..0b11e0960 100644 --- a/tests/generated/flex/padding_center_child.rs +++ b/tests/generated/flex/padding_center_child.rs @@ -37,18 +37,86 @@ fn padding_center_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,16 +160,84 @@ fn padding_center_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node, 130f32, size.width); - assert_eq!(size.height, 130f32, "height of node {:?}. Expected {}. Actual {}", node, 130f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 130f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 55f32, "x of node {:?}. Expected {}. Actual {}", node0, 55f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node0, 55f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 55f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_container_match_child.rs b/tests/generated/flex/padding_container_match_child.rs index 87bd58f38..703fa731c 100644 --- a/tests/generated/flex/padding_container_match_child.rs +++ b/tests/generated/flex/padding_container_match_child.rs @@ -32,18 +32,86 @@ fn padding_container_match_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn padding_container_match_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_flex_child.rs b/tests/generated/flex/padding_flex_child.rs index 1f2dec5db..b9171d92f 100644 --- a/tests/generated/flex/padding_flex_child.rs +++ b/tests/generated/flex/padding_flex_child.rs @@ -33,18 +33,86 @@ fn padding_flex_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +152,90 @@ fn padding_flex_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_no_child.rs b/tests/generated/flex/padding_no_child.rs index 49f53570c..c1a6dde04 100644 --- a/tests/generated/flex/padding_no_child.rs +++ b/tests/generated/flex/padding_no_child.rs @@ -19,12 +19,47 @@ fn padding_no_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -49,10 +84,45 @@ fn padding_no_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_no_size.rs b/tests/generated/flex/padding_no_size.rs index 6f4e6dcae..a4d1cb589 100644 --- a/tests/generated/flex/padding_no_size.rs +++ b/tests/generated/flex/padding_no_size.rs @@ -19,12 +19,47 @@ fn padding_no_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -49,10 +84,45 @@ fn padding_no_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/padding_stretch_child.rs b/tests/generated/flex/padding_stretch_child.rs index 07c7ac939..d871bd99e 100644 --- a/tests/generated/flex/padding_stretch_child.rs +++ b/tests/generated/flex/padding_stretch_child.rs @@ -32,18 +32,86 @@ fn padding_stretch_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn padding_stretch_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 63b7ec0e5..29414dad0 100644 --- a/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs +++ b/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs @@ -38,24 +38,137 @@ fn parent_wrap_child_size_overflowing_parent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +214,135 @@ fn parent_wrap_child_size_overflowing_parent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percent_absolute_position.rs b/tests/generated/flex/percent_absolute_position.rs index 6d7dc69b8..1a99ce461 100644 --- a/tests/generated/flex/percent_absolute_position.rs +++ b/tests/generated/flex/percent_absolute_position.rs @@ -47,30 +47,176 @@ fn percent_absolute_position__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 30f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node01, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -126,28 +272,174 @@ fn percent_absolute_position__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 30f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node0, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node01, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node01, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percent_within_flex_grow.rs b/tests/generated/flex/percent_within_flex_grow.rs index f2f33820b..7276d4a1c 100644 --- a/tests/generated/flex/percent_within_flex_grow.rs +++ b/tests/generated/flex/percent_within_flex_grow.rs @@ -48,36 +48,221 @@ fn percent_within_flex_grow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 350f32, "width of node {:?}. Expected {}. Actual {}", node, 350f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 350f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 350f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node1, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node10, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node2, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -135,34 +320,219 @@ fn percent_within_flex_grow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 350f32, "width of node {:?}. Expected {}. Actual {}", node, 350f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 350f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 350f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node1, 150f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node10, 150f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node2, 250f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_absolute_position.rs b/tests/generated/flex/percentage_absolute_position.rs index a5201b33c..f4a45ba41 100644 --- a/tests/generated/flex/percentage_absolute_position.rs +++ b/tests/generated/flex/percentage_absolute_position.rs @@ -32,18 +32,86 @@ fn percentage_absolute_position__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -82,16 +150,84 @@ fn percentage_absolute_position__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_container_in_wrapping_container.rs b/tests/generated/flex/percentage_container_in_wrapping_container.rs index dd4c7e5c3..e8fee0496 100644 --- a/tests/generated/flex/percentage_container_in_wrapping_container.rs +++ b/tests/generated/flex/percentage_container_in_wrapping_container.rs @@ -57,36 +57,221 @@ fn percentage_container_in_wrapping_container__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node000, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node001, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node001, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node001, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -156,34 +341,219 @@ fn percentage_container_in_wrapping_container__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 75f32, "y of node {:?}. Expected {}. Actual {}", node0, 75f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 75f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node00, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node000, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node000, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node001, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node001, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node001, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 50f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_different_width_height.rs b/tests/generated/flex/percentage_different_width_height.rs index 7992cf36f..c7a85839d 100644 --- a/tests/generated/flex/percentage_different_width_height.rs +++ b/tests/generated/flex/percentage_different_width_height.rs @@ -33,24 +33,125 @@ fn percentage_different_width_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +192,123 @@ fn percentage_different_width_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_different_width_height_column.rs b/tests/generated/flex/percentage_different_width_height_column.rs index 54131cc88..47ef57db8 100644 --- a/tests/generated/flex/percentage_different_width_height_column.rs +++ b/tests/generated/flex/percentage_different_width_height_column.rs @@ -28,24 +28,131 @@ fn percentage_different_width_height_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 210f32, "y of node {:?}. Expected {}. Actual {}", node1, 210f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 210f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 210f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +193,129 @@ fn percentage_different_width_height_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 210f32, "height of node {:?}. Expected {}. Actual {}", node0, 210f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 210f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 210f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node1, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 210f32, "y of node {:?}. Expected {}. Actual {}", node1, 210f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 210f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 210f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_flex_basis.rs b/tests/generated/flex/percentage_flex_basis.rs index e682a6cb2..0cd5b1f60 100644 --- a/tests/generated/flex/percentage_flex_basis.rs +++ b/tests/generated/flex/percentage_flex_basis.rs @@ -34,24 +34,137 @@ fn percentage_flex_basis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 125f32, "width of node {:?}. Expected {}. Actual {}", node0, 125f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 125f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 125f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node1, 75f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 125f32, "x of node {:?}. Expected {}. Actual {}", node1, 125f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 125f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 125f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,22 +206,135 @@ fn percentage_flex_basis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 125f32, "width of node {:?}. Expected {}. Actual {}", node0, 125f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 125f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 125f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 75f32, "width of node {:?}. Expected {}. Actual {}", node1, 75f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 125f32, "x of node {:?}. Expected {}. Actual {}", node1, 125f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 75f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 125f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 125f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_flex_basis_cross.rs b/tests/generated/flex/percentage_flex_basis_cross.rs index be57125e0..89ab7c7da 100644 --- a/tests/generated/flex/percentage_flex_basis_cross.rs +++ b/tests/generated/flex/percentage_flex_basis_cross.rs @@ -35,24 +35,137 @@ fn percentage_flex_basis_cross__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node0, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 250f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node1, 250f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,22 +208,135 @@ fn percentage_flex_basis_cross__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 250f32, "height of node {:?}. Expected {}. Actual {}", node0, 250f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 250f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 250f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 150f32, "height of node {:?}. Expected {}. Actual {}", node1, 150f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node1, 250f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 150f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 150f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5e022ab2f..aae8b608a 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_height.rs @@ -37,24 +37,131 @@ fn percentage_flex_basis_cross_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 240f32, "y of node {:?}. Expected {}. Actual {}", node1, 240f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 240f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +206,129 @@ fn percentage_flex_basis_cross_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 240f32, "y of node {:?}. Expected {}. Actual {}", node1, 240f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 240f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8049c0887..efa597132 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_width.rs @@ -37,24 +37,137 @@ fn percentage_flex_basis_cross_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node1, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +212,135 @@ fn percentage_flex_basis_cross_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node1, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3c1c6f1a1..b6d02d167 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_height.rs @@ -35,24 +35,137 @@ fn percentage_flex_basis_cross_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node1, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 240f32, "y of node {:?}. Expected {}. Actual {}", node1, 240f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 240f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,22 +208,135 @@ fn percentage_flex_basis_cross_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node1, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 240f32, "y of node {:?}. Expected {}. Actual {}", node1, 240f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 240f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 486148809..8a8e5d2f6 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_width.rs @@ -37,24 +37,137 @@ fn percentage_flex_basis_cross_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node1, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -99,22 +212,135 @@ fn percentage_flex_basis_cross_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node1, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 500f6d407..7a587de13 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_height.rs @@ -36,24 +36,131 @@ fn percentage_flex_basis_main_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node1, 148f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node1, 52f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +204,129 @@ fn percentage_flex_basis_main_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node1, 148f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node1, 52f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 80fd22f3d..1f42cdcd2 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_width.rs @@ -36,24 +36,137 @@ fn percentage_flex_basis_main_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node0, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node1, 400f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +210,135 @@ fn percentage_flex_basis_main_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node0, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node1, 400f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cdc7c787c..d0488ed3e 100644 --- a/tests/generated/flex/percentage_flex_basis_main_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_min_width.rs @@ -36,24 +36,137 @@ fn percentage_flex_basis_main_min_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node0, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node1, 80f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node1, 400f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +210,135 @@ fn percentage_flex_basis_main_min_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node0, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node1, 80f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node1, 400f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 400f32, + layout.size.height + ); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_main_max_height.rs b/tests/generated/flex/percentage_main_max_height.rs index db487ffa8..efa3732b5 100644 --- a/tests/generated/flex/percentage_main_max_height.rs +++ b/tests/generated/flex/percentage_main_max_height.rs @@ -39,30 +39,182 @@ fn percentage_main_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node, 71f32, size.width); - assert_eq!(size.height, 151f32, "height of node {:?}. Expected {}. Actual {}", node, 151f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 151f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 151f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node0, 71f32, size.width); - assert_eq!(size.height, 151f32, "height of node {:?}. Expected {}. Actual {}", node0, 151f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 151f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 151f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node00, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node01, 48f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node01, 15f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 48f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -113,28 +265,180 @@ fn percentage_main_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node, 71f32, size.width); - assert_eq!(size.height, 151f32, "height of node {:?}. Expected {}. Actual {}", node, 151f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 151f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 151f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 71f32, "width of node {:?}. Expected {}. Actual {}", node0, 71f32, size.width); - assert_eq!(size.height, 151f32, "height of node {:?}. Expected {}. Actual {}", node0, 151f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 71f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 71f32, layout.size.width); + } + if layout.size.height != 151f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 151f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node00, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node01, 48f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node01, 15f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 48f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a75c22588..55192d523 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 @@ -46,24 +46,131 @@ fn percentage_margin_should_calculate_based_only_on_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +224,129 @@ fn percentage_margin_should_calculate_based_only_on_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_moderate_complexity.rs b/tests/generated/flex/percentage_moderate_complexity.rs index 86f087e26..e178a5577 100644 --- a/tests/generated/flex/percentage_moderate_complexity.rs +++ b/tests/generated/flex/percentage_moderate_complexity.rs @@ -67,54 +67,155 @@ fn percentage_moderate_complexity__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 200f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert!( - (size.height - 42.15625f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node, - 42.15625f32, - size.height - ); - assert!((location.x - 0f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert!((location.y - 0f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if (layout.size.width - 200f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if (layout.size.height - 42.15625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 42.15625f32, + layout.size.height + ); + } + if (layout.location.x - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if (layout.location.y - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 97f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node0, 97f32, size.width); - assert!( - (size.height - 26.15625f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node0, - 26.15625f32, - size.height - ); - assert!((location.x - 8f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert!((location.y - 8f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if (layout.size.width - 97f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 97f32, layout.size.width); + } + if (layout.size.height - 26.15625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 26.15625f32, + layout.size.height + ); + } + if (layout.location.x - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if (layout.location.y - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert!( - (size.width - 38.40625f32).abs() < 0.1, - "width of node {:?}. Expected {}. Actual {}", - node00, - 38.40625f32, - size.width - ); - assert!((size.height - 6f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node00, 6f32, size.height); - assert!( - (location.x - 10.078125f32).abs() < 0.1, - "x of node {:?}. Expected {}. Actual {}", - node00, - 10.078125f32, - location.x - ); - assert!( - (location.y - 10.078125f32).abs() < 0.1, - "y of node {:?}. Expected {}. Actual {}", - node00, - 10.078125f32, - location.y - ); + if (layout.size.width - 38.40625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.width), + 38.40625f32, + layout.size.width + ); + } + if (layout.size.height - 6f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 6f32, layout.size.height); + } + if (layout.location.x - 10.078125f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(location.x), + 10.078125f32, + layout.location.x + ); + } + if (layout.location.y - 10.078125f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(location.y), + 10.078125f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -189,28 +290,123 @@ fn percentage_moderate_complexity__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 206f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 206f32, size.width); - assert!((size.height - 44f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node, 44f32, size.height); - assert!((location.x - 0f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert!((location.y - 0f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if (layout.size.width - 206f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 206f32, layout.size.width); + } + if (layout.size.height - 44f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 44f32, layout.size.height); + } + if (layout.location.x - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if (layout.location.y - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 112f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node0, 112f32, size.width); - assert!( - (size.height - 28f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node0, - 28f32, - size.height - ); - assert!((location.x - 8f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert!((location.y - 8f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if (layout.size.width - 112f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 112f32, layout.size.width); + } + if (layout.size.height - 28f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 28f32, layout.size.height); + } + if (layout.location.x - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if (layout.location.y - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 51f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node00, 51f32, size.width); - assert!((size.height - 6f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node00, 6f32, size.height); - assert!((location.x - 11f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node00, 11f32, location.x); - assert!((location.y - 11f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node00, 11f32, location.y); + if (layout.size.width - 51f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 51f32, layout.size.width); + } + if (layout.size.height - 6f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 6f32, layout.size.height); + } + if (layout.location.x - 11f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 11f32, layout.location.x); + } + if (layout.location.y - 11f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_moderate_complexity2.rs b/tests/generated/flex/percentage_moderate_complexity2.rs index 35d1184fe..951a486ff 100644 --- a/tests/generated/flex/percentage_moderate_complexity2.rs +++ b/tests/generated/flex/percentage_moderate_complexity2.rs @@ -46,24 +46,131 @@ fn percentage_moderate_complexity2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +224,129 @@ fn percentage_moderate_complexity2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b006b208a..ee89b52e5 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 @@ -96,36 +96,221 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node0, 190f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node0, 48f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 92f32, "width of node {:?}. Expected {}. Actual {}", node00, 92f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node00, 25f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node00, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node00, 8f32, location.y); + if layout.size.width != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 92f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 25f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node000, 36f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node000, 6f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node000, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node000, 10f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 6f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 142f32, "height of node {:?}. Expected {}. Actual {}", node1, 142f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 58f32, "y of node {:?}. Expected {}. Actual {}", node1, 58f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 142f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 142f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 58f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 58f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -231,34 +416,219 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node0, 190f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 103f32, "width of node {:?}. Expected {}. Actual {}", node00, 103f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node00, 26f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node00, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node00, 8f32, location.y); + if layout.size.width != 103f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 103f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 26f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node000, 48f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node000, 6f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node000, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node000, 10f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 6f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 137f32, "height of node {:?}. Expected {}. Actual {}", node1, 137f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 63f32, "y of node {:?}. Expected {}. Actual {}", node1, 63f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 137f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 137f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 63f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cad70347c..c370ef31a 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 @@ -46,24 +46,137 @@ fn percentage_padding_should_calculate_based_only_on_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +230,135 @@ fn percentage_padding_should_calculate_based_only_on_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_position_bottom_right.rs b/tests/generated/flex/percentage_position_bottom_right.rs index 4e053749c..7cd9b2b54 100644 --- a/tests/generated/flex/percentage_position_bottom_right.rs +++ b/tests/generated/flex/percentage_position_bottom_right.rs @@ -30,18 +30,86 @@ fn percentage_position_bottom_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 275f32, "width of node {:?}. Expected {}. Actual {}", node0, 275f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node0, 75f32, size.height); - assert_eq!(location.x, -100f32, "x of node {:?}. Expected {}. Actual {}", node0, -100f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node0, -50f32, location.y); + if layout.size.width != 275f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 275f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != -100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -100f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn percentage_position_bottom_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 275f32, "width of node {:?}. Expected {}. Actual {}", node0, 275f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node0, 75f32, size.height); - assert_eq!(location.x, -100f32, "x of node {:?}. Expected {}. Actual {}", node0, -100f32, location.x); - assert_eq!(location.y, -50f32, "y of node {:?}. Expected {}. Actual {}", node0, -50f32, location.y); + if layout.size.width != 275f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 275f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != -100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -100f32, layout.location.x); + } + if layout.location.y != -50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_position_left_top.rs b/tests/generated/flex/percentage_position_left_top.rs index 487e420dd..4305dbe1f 100644 --- a/tests/generated/flex/percentage_position_left_top.rs +++ b/tests/generated/flex/percentage_position_left_top.rs @@ -30,18 +30,92 @@ fn percentage_position_left_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 220f32, "height of node {:?}. Expected {}. Actual {}", node0, 220f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 220f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 220f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +152,90 @@ fn percentage_position_left_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 220f32, "height of node {:?}. Expected {}. Actual {}", node0, 220f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 220f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 220f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5a03b8c10..f32c2df85 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 @@ -36,18 +36,92 @@ fn percentage_size_based_on_parent_inner_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node0, 180f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,16 +164,90 @@ fn percentage_size_based_on_parent_inner_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 440f32, "height of node {:?}. Expected {}. Actual {}", node, 440f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 440f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 440f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_size_of_flex_basis.rs b/tests/generated/flex/percentage_size_of_flex_basis.rs index 42a19b9fd..52d43f3a9 100644 --- a/tests/generated/flex/percentage_size_of_flex_basis.rs +++ b/tests/generated/flex/percentage_size_of_flex_basis.rs @@ -32,24 +32,137 @@ fn percentage_size_of_flex_basis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,22 +205,135 @@ fn percentage_size_of_flex_basis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3b19bfcd4..259ca18ff 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 @@ -30,24 +30,137 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,22 +199,135 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/percentage_width_height.rs b/tests/generated/flex/percentage_width_height.rs index e8bd1f267..9081289cc 100644 --- a/tests/generated/flex/percentage_width_height.rs +++ b/tests/generated/flex/percentage_width_height.rs @@ -29,18 +29,92 @@ fn percentage_width_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +150,90 @@ fn percentage_width_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 400f32, "height of node {:?}. Expected {}. Actual {}", node, 400f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 400f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 22d388dd9..46d8261a3 100644 --- a/tests/generated/flex/percentage_width_height_undefined_parent_size.rs +++ b/tests/generated/flex/percentage_width_height_undefined_parent_size.rs @@ -23,18 +23,86 @@ fn percentage_width_height_undefined_parent_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn percentage_width_height_undefined_parent_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 051d89bc7..8e992058b 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 @@ -19,18 +19,86 @@ fn position_root_with_rtl_should_position_withoutdirection__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 72f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node0, 52f32, size.height); - assert_eq!(location.x, 72f32, "x of node {:?}. Expected {}. Actual {}", node0, 72f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 72f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -60,16 +128,84 @@ fn position_root_with_rtl_should_position_withoutdirection__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node, 52f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 72f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node0, 52f32, size.width); - assert_eq!(size.height, 52f32, "height of node {:?}. Expected {}. Actual {}", node0, 52f32, size.height); - assert_eq!(location.x, 72f32, "x of node {:?}. Expected {}. Actual {}", node0, 72f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 52f32, layout.size.height); + } + if layout.location.x != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 72f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e05295e99..8bd00a099 100644 --- a/tests/generated/flex/relative_position_should_not_nudge_siblings.rs +++ b/tests/generated/flex/relative_position_should_not_nudge_siblings.rs @@ -35,24 +35,125 @@ fn relative_position_should_not_nudge_siblings__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node1, 25f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -95,22 +196,123 @@ fn relative_position_should_not_nudge_siblings__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node1, 25f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6bd03fa9f..6ac6e8f60 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 @@ -25,42 +25,272 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 113f32, "width of node {:?}. Expected {}. Actual {}", node, 113f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 113f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node0, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node1, 22f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 23f32, "x of node {:?}. Expected {}. Actual {}", node1, 23f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 23f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node2, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node2, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node3, 22f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 68f32, "x of node {:?}. Expected {}. Actual {}", node3, 68f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 68f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node4, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node4, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -121,40 +351,270 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 113f32, "width of node {:?}. Expected {}. Actual {}", node, 113f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 113f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node0, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node1, 22f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 23f32, "x of node {:?}. Expected {}. Actual {}", node1, 23f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 23f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node2, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 45f32, "x of node {:?}. Expected {}. Actual {}", node2, 45f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 45f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node3, 22f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 68f32, "x of node {:?}. Expected {}. Actual {}", node3, 68f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 68f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 23f32, "width of node {:?}. Expected {}. Actual {}", node4, 23f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node4, 90f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 23f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 23f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 18c0de178..c7d4e65ec 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 @@ -23,30 +23,182 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node1, 34f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node1, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node2, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -93,28 +245,180 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node1, 34f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node1, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node2, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9077afffd..5f1ae17c3 100644 --- a/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs @@ -33,30 +33,182 @@ fn rounding_flex_basis_flex_shrink_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 101f32, "width of node {:?}. Expected {}. Actual {}", node, 101f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 101f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node0, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node1, 17f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node2, 17f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 84f32, "x of node {:?}. Expected {}. Actual {}", node2, 84f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 84f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 84f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,28 +256,180 @@ fn rounding_flex_basis_flex_shrink_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 101f32, "width of node {:?}. Expected {}. Actual {}", node, 101f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 101f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node0, 67f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node1, 17f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 17f32, "width of node {:?}. Expected {}. Actual {}", node2, 17f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 84f32, "x of node {:?}. Expected {}. Actual {}", node2, 84f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 17f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 84f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 84f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e5e735e30..79a2d10e1 100644 --- a/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs @@ -43,30 +43,164 @@ fn rounding_flex_basis_overrides_main_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_flex_basis_overrides_main_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_1.rs b/tests/generated/flex/rounding_fractial_input_1.rs index a5b65811d..8d9df8bd5 100644 --- a/tests/generated/flex/rounding_fractial_input_1.rs +++ b/tests/generated/flex/rounding_fractial_input_1.rs @@ -43,30 +43,164 @@ fn rounding_fractial_input_1__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_fractial_input_1__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_2.rs b/tests/generated/flex/rounding_fractial_input_2.rs index b5669f628..df801bafd 100644 --- a/tests/generated/flex/rounding_fractial_input_2.rs +++ b/tests/generated/flex/rounding_fractial_input_2.rs @@ -43,30 +43,164 @@ fn rounding_fractial_input_2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 114f32, "height of node {:?}. Expected {}. Actual {}", node, 114f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 114f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 114f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node0, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node1, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node2, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_fractial_input_2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 114f32, "height of node {:?}. Expected {}. Actual {}", node, 114f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 114f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 114f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 65f32, "height of node {:?}. Expected {}. Actual {}", node0, 65f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 65f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node1, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node2, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_3.rs b/tests/generated/flex/rounding_fractial_input_3.rs index a23f443ef..7a597d922 100644 --- a/tests/generated/flex/rounding_fractial_input_3.rs +++ b/tests/generated/flex/rounding_fractial_input_3.rs @@ -43,30 +43,164 @@ fn rounding_fractial_input_3__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_fractial_input_3__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_4.rs b/tests/generated/flex/rounding_fractial_input_4.rs index 01f80556a..e2cb0847a 100644 --- a/tests/generated/flex/rounding_fractial_input_4.rs +++ b/tests/generated/flex/rounding_fractial_input_4.rs @@ -43,30 +43,164 @@ fn rounding_fractial_input_4__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_fractial_input_4__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 64f32, "height of node {:?}. Expected {}. Actual {}", node0, 64f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 64f32, "y of node {:?}. Expected {}. Actual {}", node1, 64f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 64f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_5.rs b/tests/generated/flex/rounding_fractial_input_5.rs index 8ec78b7ef..dd4edaabd 100644 --- a/tests/generated/flex/rounding_fractial_input_5.rs +++ b/tests/generated/flex/rounding_fractial_input_5.rs @@ -39,24 +39,137 @@ fn rounding_fractial_input_5__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 963f32, "width of node {:?}. Expected {}. Actual {}", node, 963f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 963f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 963f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 101f32, "width of node {:?}. Expected {}. Actual {}", node0, 101f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 381f32, "x of node {:?}. Expected {}. Actual {}", node0, 381f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 101f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 381f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 381f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 482f32, "x of node {:?}. Expected {}. Actual {}", node1, 482f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 482f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 482f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -103,22 +216,135 @@ fn rounding_fractial_input_5__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 963f32, "width of node {:?}. Expected {}. Actual {}", node, 963f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 963f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 963f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 101f32, "width of node {:?}. Expected {}. Actual {}", node0, 101f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 381f32, "x of node {:?}. Expected {}. Actual {}", node0, 381f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 101f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 101f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 381f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 381f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 482f32, "x of node {:?}. Expected {}. Actual {}", node1, 482f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 482f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 482f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_6.rs b/tests/generated/flex/rounding_fractial_input_6.rs index 01a5f8dda..096aa9dfd 100644 --- a/tests/generated/flex/rounding_fractial_input_6.rs +++ b/tests/generated/flex/rounding_fractial_input_6.rs @@ -73,48 +73,305 @@ fn rounding_fractial_input_6__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 7f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node0, 4f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node01, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 3f32, "width of node {:?}. Expected {}. Actual {}", node1, 3f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node1, 4f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 3f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node11, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node11, 10f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -199,46 +456,303 @@ fn rounding_fractial_input_6__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 7f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node0, 4f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node01, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 3f32, "width of node {:?}. Expected {}. Actual {}", node1, 3f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node1, 4f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 3f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node11, 2f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node11, 10f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_fractial_input_7.rs b/tests/generated/flex/rounding_fractial_input_7.rs index 15c55c75c..31351ad18 100644 --- a/tests/generated/flex/rounding_fractial_input_7.rs +++ b/tests/generated/flex/rounding_fractial_input_7.rs @@ -129,84 +129,563 @@ fn rounding_fractial_input_7__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 7f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node00, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node01, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node1, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node1, 2f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node10, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node11, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node11, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node2, 1f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node2, 4f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node20, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node21, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node21, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node21, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node21, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node3, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node30).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node30, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node30, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node30, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node30, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node31).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node31, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node31, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node31, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node31, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -353,82 +832,561 @@ fn rounding_fractial_input_7__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 7f32, "width of node {:?}. Expected {}. Actual {}", node, 7f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 7f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node00, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node01, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node1, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 2f32, "x of node {:?}. Expected {}. Actual {}", node1, 2f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 2f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node10, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node11, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node11, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node2, 1f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node2, 4f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node20, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node21).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node21, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node21, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node21, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node21, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node21, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node21, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node3, 2f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node3, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node30).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node30, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node30, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node30, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node30, 0f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node30, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node30, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node31).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 1f32, "width of node {:?}. Expected {}. Actual {}", node31, 1f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node31, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node31, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node31, 10f32, location.y); + if layout.size.width != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(size.width), 1f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node31, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node31, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_inner_node_controversy_combined.rs b/tests/generated/flex/rounding_inner_node_controversy_combined.rs index 582ba3aec..9b6ba23f9 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_combined.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_combined.rs @@ -77,54 +77,368 @@ fn rounding_inner_node_controversy_combined__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 640f32, "width of node {:?}. Expected {}. Actual {}", node, 640f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 640f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 640f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 213f32, "width of node {:?}. Expected {}. Actual {}", node0, 213f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node0, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 213f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node1, 214f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node1, 320f32, size.height); - assert_eq!(location.x, 213f32, "x of node {:?}. Expected {}. Actual {}", node1, 213f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 213f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node10, 214f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node10, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node11, 214f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node11, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 107f32, "y of node {:?}. Expected {}. Actual {}", node11, 107f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 107f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node110).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node110, 214f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node110, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node110, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node110, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(size.width), + 214f32, + layout.size.width + ); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node110, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node110, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node12, 214f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node12, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 213f32, "y of node {:?}. Expected {}. Actual {}", node12, 213f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 213f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 213f32, "width of node {:?}. Expected {}. Actual {}", node2, 213f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node2, 320f32, size.height); - assert_eq!(location.x, 427f32, "x of node {:?}. Expected {}. Actual {}", node2, 427f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 213f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 427f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 427f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -214,52 +528,366 @@ fn rounding_inner_node_controversy_combined__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 640f32, "width of node {:?}. Expected {}. Actual {}", node, 640f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 640f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 640f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 213f32, "width of node {:?}. Expected {}. Actual {}", node0, 213f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node0, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 213f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node1, 214f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node1, 320f32, size.height); - assert_eq!(location.x, 213f32, "x of node {:?}. Expected {}. Actual {}", node1, 213f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 213f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node10, 214f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node10, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node11, 214f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node11, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node11, 0f32, location.x); - assert_eq!(location.y, 107f32, "y of node {:?}. Expected {}. Actual {}", node11, 107f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 107f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node110).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node110, 214f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node110, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node110, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node110, 0f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(size.width), + 214f32, + layout.size.width + ); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node110, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node110, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node110, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 214f32, "width of node {:?}. Expected {}. Actual {}", node12, 214f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node12, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 213f32, "y of node {:?}. Expected {}. Actual {}", node12, 213f32, location.y); + if layout.size.width != 214f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 214f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 213f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 213f32, "width of node {:?}. Expected {}. Actual {}", node2, 213f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node2, 320f32, size.height); - assert_eq!(location.x, 427f32, "x of node {:?}. Expected {}. Actual {}", node2, 427f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 213f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 427f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 427f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs index da66e0400..ebe74c7ed 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs @@ -49,36 +49,209 @@ fn rounding_inner_node_controversy_horizontal__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 107f32, "width of node {:?}. Expected {}. Actual {}", node0, 107f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 107f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 106f32, "width of node {:?}. Expected {}. Actual {}", node1, 106f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 107f32, "x of node {:?}. Expected {}. Actual {}", node1, 107f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 106f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 106f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 107f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 106f32, "width of node {:?}. Expected {}. Actual {}", node10, 106f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 106f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 106f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 107f32, "width of node {:?}. Expected {}. Actual {}", node2, 107f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 213f32, "x of node {:?}. Expected {}. Actual {}", node2, 213f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 107f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 213f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -137,34 +310,207 @@ fn rounding_inner_node_controversy_horizontal__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 107f32, "width of node {:?}. Expected {}. Actual {}", node0, 107f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 107f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 106f32, "width of node {:?}. Expected {}. Actual {}", node1, 106f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 107f32, "x of node {:?}. Expected {}. Actual {}", node1, 107f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 106f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 106f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 107f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 106f32, "width of node {:?}. Expected {}. Actual {}", node10, 106f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 106f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 106f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 107f32, "width of node {:?}. Expected {}. Actual {}", node2, 107f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 213f32, "x of node {:?}. Expected {}. Actual {}", node2, 213f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 107f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 213f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs index 2f57440bf..0be4b50eb 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs @@ -50,36 +50,227 @@ fn rounding_inner_node_controversy_vertical__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node1, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 107f32, "y of node {:?}. Expected {}. Actual {}", node1, 107f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 107f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node10, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node2, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 213f32, "y of node {:?}. Expected {}. Actual {}", node2, 213f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 213f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -139,34 +330,225 @@ fn rounding_inner_node_controversy_vertical__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 320f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node1, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 107f32, "y of node {:?}. Expected {}. Actual {}", node1, 107f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 107f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 107f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node10, 10f32, size.width); - assert_eq!(size.height, 106f32, "height of node {:?}. Expected {}. Actual {}", node10, 106f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 106f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 106f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node2, 107f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 213f32, "y of node {:?}. Expected {}. Actual {}", node2, 213f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 213f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 213f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_total_fractial.rs b/tests/generated/flex/rounding_total_fractial.rs index b0bc5ea32..24a4854e0 100644 --- a/tests/generated/flex/rounding_total_fractial.rs +++ b/tests/generated/flex/rounding_total_fractial.rs @@ -43,30 +43,164 @@ fn rounding_total_fractial__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node0, 87f32, size.width); - assert_eq!(size.height, 59f32, "height of node {:?}. Expected {}. Actual {}", node0, 59f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node1, 87f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 59f32, "y of node {:?}. Expected {}. Actual {}", node1, 59f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 59f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node2, 87f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn rounding_total_fractial__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node0, 87f32, size.width); - assert_eq!(size.height, 59f32, "height of node {:?}. Expected {}. Actual {}", node0, 59f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node1, 87f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 59f32, "y of node {:?}. Expected {}. Actual {}", node1, 59f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 59f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node2, 87f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/rounding_total_fractial_nested.rs b/tests/generated/flex/rounding_total_fractial_nested.rs index 4d956085d..5b2daf88f 100644 --- a/tests/generated/flex/rounding_total_fractial_nested.rs +++ b/tests/generated/flex/rounding_total_fractial_nested.rs @@ -65,42 +65,254 @@ fn rounding_total_fractial_nested__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node0, 87f32, size.width); - assert_eq!(size.height, 59f32, "height of node {:?}. Expected {}. Actual {}", node0, 59f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 13f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 13f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node00, 87f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node00, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, -13f32, "y of node {:?}. Expected {}. Actual {}", node00, -13f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 12f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node01, 87f32, size.width); - assert_eq!(size.height, 47f32, "height of node {:?}. Expected {}. Actual {}", node01, 47f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node01, 25f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 47f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 47f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node1, 87f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 59f32, "y of node {:?}. Expected {}. Actual {}", node1, 59f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 59f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node2, 87f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -176,40 +388,252 @@ fn rounding_total_fractial_nested__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node, 87f32, size.width); - assert_eq!(size.height, 113f32, "height of node {:?}. Expected {}. Actual {}", node, 113f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 113f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node0, 87f32, size.width); - assert_eq!(size.height, 59f32, "height of node {:?}. Expected {}. Actual {}", node0, 59f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 13f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 13f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node00, 87f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node00, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, -13f32, "y of node {:?}. Expected {}. Actual {}", node00, -13f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 12f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != -13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node01, 87f32, size.width); - assert_eq!(size.height, 47f32, "height of node {:?}. Expected {}. Actual {}", node01, 47f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node01, 25f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 47f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 47f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node1, 87f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 59f32, "y of node {:?}. Expected {}. Actual {}", node1, 59f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 59f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node2, 87f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node2, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 89f32, "y of node {:?}. Expected {}. Actual {}", node2, 89f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 89f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/scroll_size.rs b/tests/generated/flex/scroll_size.rs index 9a0b62725..a14fe508c 100644 --- a/tests/generated/flex/scroll_size.rs +++ b/tests/generated/flex/scroll_size.rs @@ -37,36 +37,92 @@ fn scroll_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 65f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 65f32, - layout.scroll_height() - ); + if layout.scroll_height() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 65f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -110,34 +166,90 @@ fn scroll_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 65f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 65f32, - layout.scroll_height() - ); + if layout.scroll_height() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 65f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/simple_child.rs b/tests/generated/flex/simple_child.rs index 40100109a..578edf049 100644 --- a/tests/generated/flex/simple_child.rs +++ b/tests/generated/flex/simple_child.rs @@ -74,48 +74,317 @@ fn simple_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node000, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node010, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node010, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node010, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node011, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node011, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node011, 10f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node011, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -205,46 +474,315 @@ fn simple_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node00, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node000, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node01, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node01, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node010, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node010, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node010, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node011).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node011, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node011, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node011, 10f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node011, 45f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node011, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node011, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 04a385ee1..871abd69d 100644 --- a/tests/generated/flex/single_flex_child_after_absolute_child.rs +++ b/tests/generated/flex/single_flex_child_after_absolute_child.rs @@ -40,30 +40,182 @@ fn single_flex_child_after_absolute_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node, 428f32, size.width); - assert_eq!(size.height, 845f32, "height of node {:?}. Expected {}. Actual {}", node, 845f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 845f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 845f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node0, 428f32, size.width); - assert_eq!(size.height, 845f32, "height of node {:?}. Expected {}. Actual {}", node0, 845f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 845f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 845f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node1, 428f32, size.width); - assert_eq!(size.height, 671f32, "height of node {:?}. Expected {}. Actual {}", node1, 671f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 671f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 671f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node2, 428f32, size.width); - assert_eq!(size.height, 174f32, "height of node {:?}. Expected {}. Actual {}", node2, 174f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 671f32, "y of node {:?}. Expected {}. Actual {}", node2, 671f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 174f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 174f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 671f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 671f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,28 +269,180 @@ fn single_flex_child_after_absolute_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node, 428f32, size.width); - assert_eq!(size.height, 845f32, "height of node {:?}. Expected {}. Actual {}", node, 845f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 845f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 845f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node0, 428f32, size.width); - assert_eq!(size.height, 845f32, "height of node {:?}. Expected {}. Actual {}", node0, 845f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 845f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 845f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node1, 428f32, size.width); - assert_eq!(size.height, 671f32, "height of node {:?}. Expected {}. Actual {}", node1, 671f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 671f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 671f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 428f32, "width of node {:?}. Expected {}. Actual {}", node2, 428f32, size.width); - assert_eq!(size.height, 174f32, "height of node {:?}. Expected {}. Actual {}", node2, 174f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 671f32, "y of node {:?}. Expected {}. Actual {}", node2, 671f32, location.y); + if layout.size.width != 428f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 428f32, layout.size.width); + } + if layout.size.height != 174f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 174f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 671f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 671f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/size_defined_by_child.rs b/tests/generated/flex/size_defined_by_child.rs index 3920a4695..4428250fe 100644 --- a/tests/generated/flex/size_defined_by_child.rs +++ b/tests/generated/flex/size_defined_by_child.rs @@ -18,18 +18,92 @@ fn size_defined_by_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -58,16 +132,90 @@ fn size_defined_by_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 01e7fe45e..694657cb0 100644 --- a/tests/generated/flex/size_defined_by_child_with_border.rs +++ b/tests/generated/flex/size_defined_by_child_with_border.rs @@ -31,18 +31,86 @@ fn size_defined_by_child_with_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn size_defined_by_child_with_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4a7d5d63d..207802582 100644 --- a/tests/generated/flex/size_defined_by_child_with_padding.rs +++ b/tests/generated/flex/size_defined_by_child_with_padding.rs @@ -31,18 +31,86 @@ fn size_defined_by_child_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn size_defined_by_child_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/size_defined_by_grand_child.rs b/tests/generated/flex/size_defined_by_grand_child.rs index e32f4692b..a97c0c543 100644 --- a/tests/generated/flex/size_defined_by_grand_child.rs +++ b/tests/generated/flex/size_defined_by_grand_child.rs @@ -19,24 +19,137 @@ fn size_defined_by_grand_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,22 +184,135 @@ fn size_defined_by_grand_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/taffy_issue_696.rs b/tests/generated/flex/taffy_issue_696.rs index 2de69fdae..c51f16d65 100644 --- a/tests/generated/flex/taffy_issue_696.rs +++ b/tests/generated/flex/taffy_issue_696.rs @@ -50,42 +50,137 @@ fn taffy_issue_696__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 140f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 140f32, - layout.scroll_height() - ); + if layout.scroll_height() != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 140f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -143,40 +238,135 @@ fn taffy_issue_696__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 100f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 100f32, - layout.scroll_height() - ); + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/taffy_issue_696_flex_basis_20.rs b/tests/generated/flex/taffy_issue_696_flex_basis_20.rs index 28d3cf338..9abca91fb 100644 --- a/tests/generated/flex/taffy_issue_696_flex_basis_20.rs +++ b/tests/generated/flex/taffy_issue_696_flex_basis_20.rs @@ -50,42 +50,137 @@ fn taffy_issue_696_flex_basis_20__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 140f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 140f32, - layout.scroll_height() - ); + if layout.scroll_height() != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 140f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -143,40 +238,135 @@ fn taffy_issue_696_flex_basis_20__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 100f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 100f32, - layout.scroll_height() - ); + if layout.scroll_height() != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 100f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/taffy_issue_696_min_height.rs b/tests/generated/flex/taffy_issue_696_min_height.rs index 17a67ff39..f49fb30ec 100644 --- a/tests/generated/flex/taffy_issue_696_min_height.rs +++ b/tests/generated/flex/taffy_issue_696_min_height.rs @@ -45,24 +45,137 @@ fn taffy_issue_696_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 120f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 120f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -115,22 +228,135 @@ fn taffy_issue_696_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 80f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node0, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 140f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 80f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/taffy_issue_696_no_flex_basis.rs b/tests/generated/flex/taffy_issue_696_no_flex_basis.rs index 27b4648d5..f81fa8dee 100644 --- a/tests/generated/flex/taffy_issue_696_no_flex_basis.rs +++ b/tests/generated/flex/taffy_issue_696_no_flex_basis.rs @@ -49,42 +49,137 @@ fn taffy_issue_696_no_flex_basis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,40 +236,135 @@ fn taffy_issue_696_no_flex_basis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node0, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 240f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/taffy_issue_696_overflow_hidden.rs b/tests/generated/flex/taffy_issue_696_overflow_hidden.rs index 8969cd368..e79e6845e 100644 --- a/tests/generated/flex/taffy_issue_696_overflow_hidden.rs +++ b/tests/generated/flex/taffy_issue_696_overflow_hidden.rs @@ -49,42 +49,131 @@ fn taffy_issue_696_overflow_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 200f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 200f32, - layout.scroll_height() - ); + if layout.scroll_height() != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 200f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,40 +230,129 @@ fn taffy_issue_696_overflow_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 200f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 200f32, - layout.scroll_height() - ); + if layout.scroll_height() != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 200f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node00, 160f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node00, 200f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/undefined_height_with_min_max.rs b/tests/generated/flex/undefined_height_with_min_max.rs index 71916d7a1..223180e21 100644 --- a/tests/generated/flex/undefined_height_with_min_max.rs +++ b/tests/generated/flex/undefined_height_with_min_max.rs @@ -26,18 +26,86 @@ fn undefined_height_with_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -70,16 +138,84 @@ fn undefined_height_with_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/undefined_width_with_min_max.rs b/tests/generated/flex/undefined_width_with_min_max.rs index 0a6d329a8..19717d518 100644 --- a/tests/generated/flex/undefined_width_with_min_max.rs +++ b/tests/generated/flex/undefined_width_with_min_max.rs @@ -25,18 +25,86 @@ fn undefined_width_with_min_max__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -68,16 +136,84 @@ fn undefined_width_with_min_max__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ddd5ef770..0aa98fb6f 100644 --- a/tests/generated/flex/undefined_width_with_min_max_row.rs +++ b/tests/generated/flex/undefined_width_with_min_max_row.rs @@ -36,24 +36,131 @@ fn undefined_width_with_min_max_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -97,22 +204,129 @@ fn undefined_width_with_min_max_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node00, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 36a380b13..02d3c3ef8 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 @@ -57,36 +57,227 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 38cb36d98..a84491a96 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 @@ -57,36 +57,227 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 60f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 5f32, "width of node {:?}. Expected {}. Actual {}", node0, 5f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 5f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 5f32, "width of node {:?}. Expected {}. Actual {}", node1, 5f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node1, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 5f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 60f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 5f32, "width of node {:?}. Expected {}. Actual {}", node0, 5f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 5f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 5f32, "width of node {:?}. Expected {}. Actual {}", node1, 5f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node1, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 5f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 15f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a64607063..279cee152 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 @@ -49,36 +49,227 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 70f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 70f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,34 +332,225 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 70f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 70f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 70f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a617ec764..273a17d27 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 @@ -57,36 +57,227 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -153,34 +344,225 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node10, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_child.rs b/tests/generated/flex/wrap_child.rs index 8a4df9b28..8b7a0ea0d 100644 --- a/tests/generated/flex/wrap_child.rs +++ b/tests/generated/flex/wrap_child.rs @@ -23,18 +23,92 @@ fn wrap_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +141,90 @@ fn wrap_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_column.rs b/tests/generated/flex/wrap_column.rs index ce5d3adbf..2a44d81f5 100644 --- a/tests/generated/flex/wrap_column.rs +++ b/tests/generated/flex/wrap_column.rs @@ -58,36 +58,203 @@ fn wrap_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node0, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node1, 31f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node2, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 63f32, "y of node {:?}. Expected {}. Actual {}", node2, 63f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 63f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node3, 34f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -155,34 +322,201 @@ fn wrap_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node0, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node1, 31f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node2, 33f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 63f32, "y of node {:?}. Expected {}. Actual {}", node2, 63f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 63f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node3, 34f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_grandchild.rs b/tests/generated/flex/wrap_grandchild.rs index 1b86e9978..26ca414d2 100644 --- a/tests/generated/flex/wrap_grandchild.rs +++ b/tests/generated/flex/wrap_grandchild.rs @@ -19,24 +19,137 @@ fn wrap_grandchild__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,22 +184,135 @@ fn wrap_grandchild__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node00, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9a1adcaaa..d73df9cba 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 @@ -65,42 +65,266 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node000, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node01, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node010, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node010, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node010, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -179,40 +403,264 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node0, 70f32, size.width); - assert_eq!(size.height, 90f32, "height of node {:?}. Expected {}. Actual {}", node0, 90f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 90f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node000, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node01, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node010, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node010, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node010, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 86c76156b..28e9f8c34 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 @@ -65,42 +65,266 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node0, 85f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node000, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node01, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node010, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node010, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node010, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -179,40 +403,264 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 500f32, "width of node {:?}. Expected {}. Actual {}", node, 500f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 500f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 85f32, "width of node {:?}. Expected {}. Actual {}", node0, 85f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 85f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 85f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node000, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node000, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node01, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node010, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node010, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node010, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_reverse_column.rs b/tests/generated/flex/wrap_reverse_column.rs index 107ddbd9a..973356010 100644 --- a/tests/generated/flex/wrap_reverse_column.rs +++ b/tests/generated/flex/wrap_reverse_column.rs @@ -58,36 +58,203 @@ fn wrap_reverse_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node0, 31f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node1, 31f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node2, 33f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 63f32, "y of node {:?}. Expected {}. Actual {}", node2, 63f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 63f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node3, 34f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -155,34 +322,201 @@ fn wrap_reverse_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node0, 31f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node0, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 31f32, "y of node {:?}. Expected {}. Actual {}", node1, 31f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 31f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 33f32, "height of node {:?}. Expected {}. Actual {}", node2, 33f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 63f32, "y of node {:?}. Expected {}. Actual {}", node2, 63f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 33f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 63f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 34f32, "height of node {:?}. Expected {}. Actual {}", node3, 34f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 34f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_reverse_column_fixed_size.rs b/tests/generated/flex/wrap_reverse_column_fixed_size.rs index 0c3a1bfda..e4e17723d 100644 --- a/tests/generated/flex/wrap_reverse_column_fixed_size.rs +++ b/tests/generated/flex/wrap_reverse_column_fixed_size.rs @@ -68,42 +68,242 @@ fn wrap_reverse_column_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node0, 135f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node1, 135f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node2, 135f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node3, 135f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node4, 35f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -182,40 +382,240 @@ fn wrap_reverse_column_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node0, 135f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node1, 135f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node2, 135f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node3, 135f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 35f32, "x of node {:?}. Expected {}. Actual {}", node4, 35f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 35f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_reverse_row.rs b/tests/generated/flex/wrap_reverse_row.rs index c762a9a6e..0baa4311b 100644 --- a/tests/generated/flex/wrap_reverse_row.rs +++ b/tests/generated/flex/wrap_reverse_row.rs @@ -54,36 +54,203 @@ fn wrap_reverse_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 31f32, "width of node {:?}. Expected {}. Actual {}", node0, 31f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 31f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node1, 32f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node3, 34f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,34 +314,201 @@ fn wrap_reverse_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 31f32, "width of node {:?}. Expected {}. Actual {}", node0, 31f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 31f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node1, 32f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node2, 30f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node3, 34f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e49dad9ad..830b56bb2 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_center.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_center.rs @@ -64,42 +64,242 @@ fn wrap_reverse_row_align_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn wrap_reverse_row_align_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c11226dc3..1d939ac21 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 @@ -64,42 +64,242 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b2196df1d..0250d6c90 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 @@ -64,42 +64,242 @@ fn wrap_reverse_row_align_content_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn wrap_reverse_row_align_content_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9e7603d35..ec705638c 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs @@ -64,42 +64,242 @@ fn wrap_reverse_row_align_content_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn wrap_reverse_row_align_content_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node0, 70f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node4, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8e4ff528a..7aed273bf 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 @@ -64,42 +64,242 @@ fn wrap_reverse_row_single_line_different_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node3, 90f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,40 +374,240 @@ fn wrap_reverse_row_single_line_different_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 300f32, "width of node {:?}. Expected {}. Actual {}", node, 300f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 300f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node3, 90f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node4, 50f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_row.rs b/tests/generated/flex/wrap_row.rs index 8cb72cbfb..ab56159de 100644 --- a/tests/generated/flex/wrap_row.rs +++ b/tests/generated/flex/wrap_row.rs @@ -54,36 +54,203 @@ fn wrap_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 31f32, "width of node {:?}. Expected {}. Actual {}", node0, 31f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 31f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node1, 32f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node3, 34f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,34 +314,201 @@ fn wrap_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 31f32, "width of node {:?}. Expected {}. Actual {}", node0, 31f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 31f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node1, 32f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 31f32, "x of node {:?}. Expected {}. Actual {}", node1, 31f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 31f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node2, 33f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 63f32, "x of node {:?}. Expected {}. Actual {}", node2, 63f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 63f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 63f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node3, 34f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrap_row_align_items_center.rs b/tests/generated/flex/wrap_row_align_items_center.rs index ebb6a5686..5a4f2b27e 100644 --- a/tests/generated/flex/wrap_row_align_items_center.rs +++ b/tests/generated/flex/wrap_row_align_items_center.rs @@ -55,36 +55,203 @@ fn wrap_row_align_items_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,34 +316,201 @@ fn wrap_row_align_items_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ed9bb1596..0f17595aa 100644 --- a/tests/generated/flex/wrap_row_align_items_flex_end.rs +++ b/tests/generated/flex/wrap_row_align_items_flex_end.rs @@ -55,36 +55,203 @@ fn wrap_row_align_items_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,34 +316,201 @@ fn wrap_row_align_items_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrapped_column_max_height.rs b/tests/generated/flex/wrapped_column_max_height.rs index a95ad7ba8..d3aa057d8 100644 --- a/tests/generated/flex/wrapped_column_max_height.rs +++ b/tests/generated/flex/wrapped_column_max_height.rs @@ -59,30 +59,182 @@ fn wrapped_column_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 700f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 700f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node0, 250f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node1, 250f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 420f32, "x of node {:?}. Expected {}. Actual {}", node2, 420f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node2, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 420f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 420f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -150,28 +302,180 @@ fn wrapped_column_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 700f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 700f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node0, 250f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node0, 30f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node1, 250f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 420f32, "x of node {:?}. Expected {}. Actual {}", node2, 420f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node2, 200f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 420f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 420f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/flex/wrapped_column_max_height_flex.rs b/tests/generated/flex/wrapped_column_max_height_flex.rs index dbaa770d3..9d4cfa134 100644 --- a/tests/generated/flex/wrapped_column_max_height_flex.rs +++ b/tests/generated/flex/wrapped_column_max_height_flex.rs @@ -65,30 +65,182 @@ fn wrapped_column_max_height_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 700f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 700f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node0, 180f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node0, 300f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node1, 180f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node1, 200f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node2, 300f32, location.x); - assert_eq!(location.y, 400f32, "y of node {:?}. Expected {}. Actual {}", node2, 400f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 400f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,28 +314,180 @@ fn wrapped_column_max_height_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 700f32, "width of node {:?}. Expected {}. Actual {}", node, 700f32, size.width); - assert_eq!(size.height, 500f32, "height of node {:?}. Expected {}. Actual {}", node, 500f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 700f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 700f32, layout.size.width); + } + if layout.size.height != 500f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 500f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node0, 180f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node0, 300f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node1, 180f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node1, 250f32, location.x); - assert_eq!(location.y, 200f32, "y of node {:?}. Expected {}. Actual {}", node1, 200f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 180f32, + layout.size.height + ); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 200f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 300f32, "x of node {:?}. Expected {}. Actual {}", node2, 300f32, location.x); - assert_eq!(location.y, 400f32, "y of node {:?}. Expected {}. Actual {}", node2, 400f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 300f32, layout.location.x); + } + if layout.location.y != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 400f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f0290f20a..f6124063c 100644 --- a/tests/generated/flex/wrapped_row_within_align_items_center.rs +++ b/tests/generated/flex/wrapped_row_within_align_items_center.rs @@ -46,30 +46,182 @@ fn wrapped_row_within_align_items_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,28 +279,180 @@ fn wrapped_row_within_align_items_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 791cfa5c8..178457a59 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 @@ -46,30 +46,182 @@ fn wrapped_row_within_align_items_flex_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,28 +279,180 @@ fn wrapped_row_within_align_items_flex_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 07bea8723..ccb8dc97b 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 @@ -46,30 +46,182 @@ fn wrapped_row_within_align_items_flex_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -127,28 +279,180 @@ fn wrapped_row_within_align_items_flex_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node0, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node00, 150f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node00, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node01, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node01, 80f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/chrome_issue_325928327.rs b/tests/generated/grid/chrome_issue_325928327.rs index 8658f667b..c6cb755f8 100644 --- a/tests/generated/grid/chrome_issue_325928327.rs +++ b/tests/generated/grid/chrome_issue_325928327.rs @@ -38,24 +38,131 @@ fn chrome_issue_325928327__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +208,129 @@ fn chrome_issue_325928327__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 76fdc2f27..e839763e2 100644 --- a/tests/generated/grid/grid_absolute_align_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_align_self_sized_all.rs @@ -111,60 +111,359 @@ fn grid_absolute_align_self_sized_all__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -289,58 +588,357 @@ fn grid_absolute_align_self_sized_all__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_column_end.rs b/tests/generated/grid/grid_absolute_column_end.rs index 895e89d48..d07c47170 100644 --- a/tests/generated/grid/grid_absolute_column_end.rs +++ b/tests/generated/grid/grid_absolute_column_end.rs @@ -38,18 +38,92 @@ fn grid_absolute_column_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 157f32, "height of node {:?}. Expected {}. Actual {}", node0, 157f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 157f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 157f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +168,90 @@ fn grid_absolute_column_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 157f32, "height of node {:?}. Expected {}. Actual {}", node0, 157f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 157f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 157f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_column_start.rs b/tests/generated/grid/grid_absolute_column_start.rs index 2888f98f5..487c7934e 100644 --- a/tests/generated/grid/grid_absolute_column_start.rs +++ b/tests/generated/grid/grid_absolute_column_start.rs @@ -38,18 +38,92 @@ fn grid_absolute_column_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 133f32, "width of node {:?}. Expected {}. Actual {}", node0, 133f32, size.width); - assert_eq!(size.height, 157f32, "height of node {:?}. Expected {}. Actual {}", node0, 157f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 133f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 133f32, layout.size.width); + } + if layout.size.height != 157f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 157f32, + layout.size.height + ); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +168,90 @@ fn grid_absolute_column_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 133f32, "width of node {:?}. Expected {}. Actual {}", node0, 133f32, size.width); - assert_eq!(size.height, 157f32, "height of node {:?}. Expected {}. Actual {}", node0, 157f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 133f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 133f32, layout.size.width); + } + if layout.size.height != 157f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 157f32, + layout.size.height + ); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_container_bottom_left.rs b/tests/generated/grid/grid_absolute_container_bottom_left.rs index 8f3bcad1b..e017e3d61 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left.rs @@ -40,66 +40,398 @@ fn grid_absolute_container_bottom_left__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node0, 160f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_absolute_container_bottom_left__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node0, 160f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 384bd7746..dad403b84 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs @@ -50,66 +50,398 @@ fn grid_absolute_container_bottom_left_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node0, 147f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -182,64 +514,396 @@ fn grid_absolute_container_bottom_left_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node0, 147f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dca8245ff..c548e43b2 100644 --- a/tests/generated/grid/grid_absolute_container_left_overrides_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_overrides_right.rs @@ -41,66 +41,398 @@ fn grid_absolute_container_left_overrides_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_absolute_container_left_overrides_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_container_left_right.rs b/tests/generated/grid/grid_absolute_container_left_right.rs index d1855a7a9..20dcada24 100644 --- a/tests/generated/grid/grid_absolute_container_left_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_right.rs @@ -40,66 +40,398 @@ fn grid_absolute_container_left_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_absolute_container_left_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 63fee83c6..1c8a4fee7 100644 --- a/tests/generated/grid/grid_absolute_container_left_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_left_right_margin.rs @@ -46,66 +46,398 @@ fn grid_absolute_container_left_right_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 167f32, "width of node {:?}. Expected {}. Actual {}", node0, 167f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 9f32, "x of node {:?}. Expected {}. Actual {}", node0, 9f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 167f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 167f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 9f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,64 +506,396 @@ fn grid_absolute_container_left_right_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 167f32, "width of node {:?}. Expected {}. Actual {}", node0, 167f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 9f32, "x of node {:?}. Expected {}. Actual {}", node0, 9f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 167f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 167f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 9f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_container_negative_position.rs b/tests/generated/grid/grid_absolute_container_negative_position.rs index 4eb0b42ee..c87c8a5d3 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position.rs @@ -46,66 +46,398 @@ fn grid_absolute_container_negative_position__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node0, 195f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, -35f32, "x of node {:?}. Expected {}. Actual {}", node1, -35f32, location.x); - assert_eq!(location.y, 185f32, "y of node {:?}. Expected {}. Actual {}", node1, 185f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -35f32, layout.location.x); + } + if layout.location.y != 185f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 185f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_absolute_container_negative_position__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node0, 195f32, location.x); - assert_eq!(location.y, -5f32, "y of node {:?}. Expected {}. Actual {}", node0, -5f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != -5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, -35f32, "x of node {:?}. Expected {}. Actual {}", node1, -35f32, location.x); - assert_eq!(location.y, 185f32, "y of node {:?}. Expected {}. Actual {}", node1, 185f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != -35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -35f32, layout.location.x); + } + if layout.location.y != 185f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 185f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5233c68a2..4fd9914af 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position_margin.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position_margin.rs @@ -58,66 +58,398 @@ fn grid_absolute_container_negative_position_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 193f32, "x of node {:?}. Expected {}. Actual {}", node0, 193f32, location.x); - assert_eq!(location.y, -4f32, "y of node {:?}. Expected {}. Actual {}", node0, -4f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 193f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 193f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, -31f32, "x of node {:?}. Expected {}. Actual {}", node1, -31f32, location.x); - assert_eq!(location.y, 182f32, "y of node {:?}. Expected {}. Actual {}", node1, 182f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != -31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -31f32, layout.location.x); + } + if layout.location.y != 182f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 182f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -197,64 +529,396 @@ fn grid_absolute_container_negative_position_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 193f32, "x of node {:?}. Expected {}. Actual {}", node0, 193f32, location.x); - assert_eq!(location.y, -4f32, "y of node {:?}. Expected {}. Actual {}", node0, -4f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 193f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 193f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, -31f32, "x of node {:?}. Expected {}. Actual {}", node1, -31f32, location.x); - assert_eq!(location.y, 182f32, "y of node {:?}. Expected {}. Actual {}", node1, 182f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != -31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), -31f32, layout.location.x); + } + if layout.location.y != 182f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 182f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_container_top_bottom.rs b/tests/generated/grid/grid_absolute_container_top_bottom.rs index 384d896da..bab30cbfa 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom.rs @@ -40,66 +40,404 @@ fn grid_absolute_container_top_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 153f32, "height of node {:?}. Expected {}. Actual {}", node0, 153f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 153f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 153f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +500,402 @@ fn grid_absolute_container_top_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 153f32, "height of node {:?}. Expected {}. Actual {}", node0, 153f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 153f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 153f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9fa04d29a..490ba3cc8 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs @@ -46,66 +46,404 @@ fn grid_absolute_container_top_bottom_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 149f32, "height of node {:?}. Expected {}. Actual {}", node0, 149f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 149f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 149f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,64 +512,402 @@ fn grid_absolute_container_top_bottom_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 149f32, "height of node {:?}. Expected {}. Actual {}", node0, 149f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 149f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 149f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_container_top_right.rs b/tests/generated/grid/grid_absolute_container_top_right.rs index 6a76a5312..cc6dae1b3 100644 --- a/tests/generated/grid/grid_absolute_container_top_right.rs +++ b/tests/generated/grid/grid_absolute_container_top_right.rs @@ -40,66 +40,398 @@ fn grid_absolute_container_top_right__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_absolute_container_top_right__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 05e1ec593..a03133dc9 100644 --- a/tests/generated/grid/grid_absolute_container_top_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_right_margin.rs @@ -46,66 +46,398 @@ fn grid_absolute_container_top_right_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 178f32, "x of node {:?}. Expected {}. Actual {}", node0, 178f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 178f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 178f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -174,64 +506,396 @@ fn grid_absolute_container_top_right_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 178f32, "x of node {:?}. Expected {}. Actual {}", node0, 178f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 178f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 178f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7442fc67f..cf3ce6682 100644 --- a/tests/generated/grid/grid_absolute_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_justify_self_sized_all.rs @@ -111,60 +111,359 @@ fn grid_absolute_justify_self_sized_all__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node5, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -289,58 +588,357 @@ fn grid_absolute_justify_self_sized_all__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node5, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_layout_within_border.rs b/tests/generated/grid/grid_absolute_layout_within_border.rs index eef6e52b1..16283c512 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border.rs @@ -89,36 +89,203 @@ fn grid_absolute_layout_within_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -217,34 +384,201 @@ fn grid_absolute_layout_within_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node3, 70f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b24fe0cf8..9cdfb74d4 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border_static.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border_static.rs @@ -93,36 +93,203 @@ fn grid_absolute_layout_within_border_static__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -225,34 +392,201 @@ fn grid_absolute_layout_within_border_static__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 140f32, "height of node {:?}. Expected {}. Actual {}", node, 140f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 140f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node3, 70f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node3, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_overflow_clip.rs b/tests/generated/grid/grid_absolute_overflow_clip.rs new file mode 100644 index 000000000..349f6d94d --- /dev/null +++ b/tests/generated/grid/grid_absolute_overflow_clip.rs @@ -0,0 +1,289 @@ +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_absolute_overflow_hidden.rs b/tests/generated/grid/grid_absolute_overflow_hidden.rs new file mode 100644 index 000000000..699964204 --- /dev/null +++ b/tests/generated/grid/grid_absolute_overflow_hidden.rs @@ -0,0 +1,295 @@ +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_absolute_overflow_scroll.rs b/tests/generated/grid/grid_absolute_overflow_scroll.rs new file mode 100644 index 000000000..914601864 --- /dev/null +++ b/tests/generated/grid/grid_absolute_overflow_scroll.rs @@ -0,0 +1,295 @@ +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 66f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 66f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 43f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 43f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 52f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 52f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_absolute_overflow_visible.rs b/tests/generated/grid/grid_absolute_overflow_visible.rs new file mode 100644 index 000000000..61b86d6e5 --- /dev/null +++ b/tests/generated/grid/grid_absolute_overflow_visible.rs @@ -0,0 +1,285 @@ +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 51f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 51f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_absolute_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + position: taffy::style::Position::Absolute, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + inset: taffy::geometry::Rect { + left: length(-10f32), + right: auto(), + top: length(-5f32), + bottom: auto(), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 28f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 28f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 37f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 37f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != -3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -3f32, layout.location.x); + } + if layout.location.y != -4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), -4f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_absolute_resolved_insets.rs b/tests/generated/grid/grid_absolute_resolved_insets.rs index 930a8de1f..5a5873ace 100644 --- a/tests/generated/grid/grid_absolute_resolved_insets.rs +++ b/tests/generated/grid/grid_absolute_resolved_insets.rs @@ -166,114 +166,617 @@ fn grid_absolute_resolved_insets__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node0, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node02, 180f32, location.x); - assert_eq!(location.y, 180f32, "y of node {:?}. Expected {}. Actual {}", node02, 180f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 180f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node05, 160f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node05, 160f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 160f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node1, 200f32, size.height); - assert_eq!(location.x, 200f32, "x of node {:?}. Expected {}. Actual {}", node1, 200f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 200f32, + layout.size.height + ); + } + if layout.location.x != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 200f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 165f32, "x of node {:?}. Expected {}. Actual {}", node12, 165f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node12, 165f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 165f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 145f32, "width of node {:?}. Expected {}. Actual {}", node15, 145f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node15, 145f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 145f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 145f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -463,112 +966,615 @@ fn grid_absolute_resolved_insets__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 540f32, "width of node {:?}. Expected {}. Actual {}", node, 540f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 540f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 540f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 270f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node0, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node0, 270f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node01, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node01, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node02, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node02, 0f32, size.height); - assert_eq!(location.x, 250f32, "x of node {:?}. Expected {}. Actual {}", node02, 250f32, location.x); - assert_eq!(location.y, 250f32, "y of node {:?}. Expected {}. Actual {}", node02, 250f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 250f32, layout.location.x); + } + if layout.location.y != 250f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 250f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node03, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node03, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node03, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node04, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node04, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 230f32, "width of node {:?}. Expected {}. Actual {}", node05, 230f32, size.width); - assert_eq!(size.height, 230f32, "height of node {:?}. Expected {}. Actual {}", node05, 230f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node05, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node05, 20f32, location.y); + if layout.size.width != 230f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 230f32, layout.size.width); + } + if layout.size.height != 230f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 230f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 270f32, "width of node {:?}. Expected {}. Actual {}", node1, 270f32, size.width); - assert_eq!(size.height, 270f32, "height of node {:?}. Expected {}. Actual {}", node1, 270f32, size.height); - assert_eq!(location.x, 270f32, "x of node {:?}. Expected {}. Actual {}", node1, 270f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node1, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 270f32, layout.size.width); + } + if layout.size.height != 270f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 270f32, + layout.size.height + ); + } + if layout.location.x != 270f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 270f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node10, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node10, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node10, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node11, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node11, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node11, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node11, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node12, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node12, 0f32, size.height); - assert_eq!(location.x, 235f32, "x of node {:?}. Expected {}. Actual {}", node12, 235f32, location.x); - assert_eq!(location.y, 235f32, "y of node {:?}. Expected {}. Actual {}", node12, 235f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 235f32, layout.location.x); + } + if layout.location.y != 235f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 235f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node13, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node13, 0f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node13, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node14, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node14, 0f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node14, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node14, 50f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 215f32, "width of node {:?}. Expected {}. Actual {}", node15, 215f32, size.width); - assert_eq!(size.height, 215f32, "height of node {:?}. Expected {}. Actual {}", node15, 215f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node15, 20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node15, 20f32, location.y); + if layout.size.width != 215f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 215f32, layout.size.width); + } + if layout.size.height != 215f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 215f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_row_end.rs b/tests/generated/grid/grid_absolute_row_end.rs index 09340b190..05e957fc1 100644 --- a/tests/generated/grid/grid_absolute_row_end.rs +++ b/tests/generated/grid/grid_absolute_row_end.rs @@ -38,18 +38,86 @@ fn grid_absolute_row_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 7f32, "height of node {:?}. Expected {}. Actual {}", node0, 7f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 7f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +162,84 @@ fn grid_absolute_row_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 7f32, "height of node {:?}. Expected {}. Actual {}", node0, 7f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 7f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 7f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_row_start.rs b/tests/generated/grid/grid_absolute_row_start.rs index 38c6dbd92..ec683968d 100644 --- a/tests/generated/grid/grid_absolute_row_start.rs +++ b/tests/generated/grid/grid_absolute_row_start.rs @@ -38,18 +38,92 @@ fn grid_absolute_row_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 147f32, "height of node {:?}. Expected {}. Actual {}", node0, 147f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 147f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 147f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,16 +168,90 @@ fn grid_absolute_row_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 173f32, "width of node {:?}. Expected {}. Actual {}", node0, 173f32, size.width); - assert_eq!(size.height, 147f32, "height of node {:?}. Expected {}. Actual {}", node0, 147f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 173f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 173f32, layout.size.width); + } + if layout.size.height != 147f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 147f32, + layout.size.height + ); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs index abda6474c..0bcccfb30 100644 --- a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs +++ b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs @@ -41,66 +41,398 @@ fn grid_absolute_top_overrides_bottom__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_absolute_top_overrides_bottom__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node0, 2f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node3, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node6, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_absolute_with_padding.rs b/tests/generated/grid/grid_absolute_with_padding.rs index 5a34948ee..4de8dd532 100644 --- a/tests/generated/grid/grid_absolute_with_padding.rs +++ b/tests/generated/grid/grid_absolute_with_padding.rs @@ -46,66 +46,398 @@ fn grid_absolute_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node1, 150f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_absolute_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 180f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node1, 10f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node1, 150f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9e2e3433a..40f952091 100644 --- a/tests/generated/grid/grid_absolute_with_padding_and_margin.rs +++ b/tests/generated/grid/grid_absolute_with_padding_and_margin.rs @@ -58,66 +58,398 @@ fn grid_absolute_with_padding_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 178f32, "x of node {:?}. Expected {}. Actual {}", node0, 178f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 178f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 178f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 14f32, "x of node {:?}. Expected {}. Actual {}", node1, 14f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node1, 147f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 14f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -197,64 +529,396 @@ fn grid_absolute_with_padding_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 178f32, "x of node {:?}. Expected {}. Actual {}", node0, 178f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 178f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 178f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 14f32, "x of node {:?}. Expected {}. Actual {}", node1, 14f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node1, 147f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 14f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node3, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node4, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node7, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_center.rs b/tests/generated/grid/grid_align_content_center.rs index cb0abbdb0..001c34e62 100644 --- a/tests/generated/grid/grid_align_content_center.rs +++ b/tests/generated/grid/grid_align_content_center.rs @@ -33,66 +33,398 @@ fn grid_align_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node7, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node7, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a6d0470f8..2af8f00f0 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 @@ -54,72 +54,497 @@ fn grid_align_content_center_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node00, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node01, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node03, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node04, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node05, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node06, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node07, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node08, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_center_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node00, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node01, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, -10f32, "y of node {:?}. Expected {}. Actual {}", node02, -10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node03, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node04, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node05, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node06, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node07, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node08, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_end.rs b/tests/generated/grid/grid_align_content_end.rs index f2fdc12fa..5e0ae25fd 100644 --- a/tests/generated/grid/grid_align_content_end.rs +++ b/tests/generated/grid/grid_align_content_end.rs @@ -33,66 +33,398 @@ fn grid_align_content_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node3, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node4, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node5, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node0, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node3, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node4, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node5, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 617a505b3..9169255de 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 @@ -54,72 +54,497 @@ fn grid_align_content_end_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node00, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node01, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node02, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node03, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node04, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node05, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_end_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node00, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node01, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, -20f32, "y of node {:?}. Expected {}. Actual {}", node02, -20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), -20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node03, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node04, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node05, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 1cc1e34ba..4361c5c0e 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 @@ -45,66 +45,398 @@ fn grid_align_content_end_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 44f32, "y of node {:?}. Expected {}. Actual {}", node0, 44f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 44f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 44f32, "y of node {:?}. Expected {}. Actual {}", node1, 44f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 44f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 44f32, "y of node {:?}. Expected {}. Actual {}", node2, 44f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 44f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 84f32, "y of node {:?}. Expected {}. Actual {}", node3, 84f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 84f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 84f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 84f32, "y of node {:?}. Expected {}. Actual {}", node4, 84f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 84f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 84f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 84f32, "y of node {:?}. Expected {}. Actual {}", node5, 84f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 84f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 84f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node6, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node7, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node8, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_align_content_end_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node0, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node1, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node2, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 132f32, "y of node {:?}. Expected {}. Actual {}", node3, 132f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 132f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 132f32, "y of node {:?}. Expected {}. Actual {}", node4, 132f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 132f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 132f32, "y of node {:?}. Expected {}. Actual {}", node5, 132f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 132f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node6, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node7, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node8, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_space_around.rs b/tests/generated/grid/grid_align_content_space_around.rs index 90e8bfff4..c9ecb822b 100644 --- a/tests/generated/grid/grid_align_content_space_around.rs +++ b/tests/generated/grid/grid_align_content_space_around.rs @@ -33,66 +33,398 @@ fn grid_align_content_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node0, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node2, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node6, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node7, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node8, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node0, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node1, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node2, 13f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node6, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node7, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 147f32, "y of node {:?}. Expected {}. Actual {}", node8, 147f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 147f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a0418ea69..6b6370ddf 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 @@ -54,72 +54,497 @@ fn grid_align_content_space_around_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_space_around_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 47d92ac5d..1abc0e371 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 @@ -45,66 +45,398 @@ fn grid_align_content_space_around_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 17f32, "y of node {:?}. Expected {}. Actual {}", node0, 17f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 17f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 17f32, "y of node {:?}. Expected {}. Actual {}", node1, 17f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 17f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 17f32, "y of node {:?}. Expected {}. Actual {}", node2, 17f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 17f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node3, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node4, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node5, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 119f32, "y of node {:?}. Expected {}. Actual {}", node6, 119f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 119f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 119f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 119f32, "y of node {:?}. Expected {}. Actual {}", node7, 119f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 119f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 119f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 119f32, "y of node {:?}. Expected {}. Actual {}", node8, 119f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 119f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 119f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_align_content_space_around_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node0, 25f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node1, 25f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 25f32, "y of node {:?}. Expected {}. Actual {}", node2, 25f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 25f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node3, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node4, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node5, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 159f32, "y of node {:?}. Expected {}. Actual {}", node6, 159f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 159f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 159f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 159f32, "y of node {:?}. Expected {}. Actual {}", node7, 159f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 159f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 159f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 159f32, "y of node {:?}. Expected {}. Actual {}", node8, 159f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 159f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 159f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_space_between.rs b/tests/generated/grid/grid_align_content_space_between.rs index ae341c6f1..06457fe88 100644 --- a/tests/generated/grid/grid_align_content_space_between.rs +++ b/tests/generated/grid/grid_align_content_space_between.rs @@ -33,66 +33,398 @@ fn grid_align_content_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9899416e1..c58d965f0 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 @@ -54,72 +54,497 @@ fn grid_align_content_space_between_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_space_between_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 74be09106..b6bb48136 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 @@ -45,66 +45,398 @@ fn grid_align_content_space_between_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node3, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node4, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node5, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node6, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node7, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 124f32, "y of node {:?}. Expected {}. Actual {}", node8, 124f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 124f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_align_content_space_between_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node3, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node4, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node5, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node6, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node7, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 172f32, "y of node {:?}. Expected {}. Actual {}", node8, 172f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 172f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 172f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_space_evenly.rs b/tests/generated/grid/grid_align_content_space_evenly.rs index fa841cc08..ca6429d34 100644 --- a/tests/generated/grid/grid_align_content_space_evenly.rs +++ b/tests/generated/grid/grid_align_content_space_evenly.rs @@ -33,66 +33,398 @@ fn grid_align_content_space_evenly__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node6, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node7, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node8, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_space_evenly__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node6, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node7, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node8, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9b388aff8..aff60796d 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 @@ -54,72 +54,497 @@ fn grid_align_content_space_evenly_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_space_evenly_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 865b84e0d..1400a5b89 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 @@ -45,66 +45,398 @@ fn grid_align_content_space_evenly_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node3, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node4, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node5, 68f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 116f32, "y of node {:?}. Expected {}. Actual {}", node6, 116f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 116f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 116f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 116f32, "y of node {:?}. Expected {}. Actual {}", node7, 116f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 116f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 116f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 116f32, "y of node {:?}. Expected {}. Actual {}", node8, 116f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 116f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 116f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_align_content_space_evenly_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 32f32, "y of node {:?}. Expected {}. Actual {}", node0, 32f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 32f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 32f32, "y of node {:?}. Expected {}. Actual {}", node1, 32f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 32f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 32f32, "y of node {:?}. Expected {}. Actual {}", node2, 32f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 32f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node3, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node4, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node5, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 152f32, "y of node {:?}. Expected {}. Actual {}", node6, 152f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 152f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 152f32, "y of node {:?}. Expected {}. Actual {}", node7, 152f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 152f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 152f32, "y of node {:?}. Expected {}. Actual {}", node8, 152f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 152f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 152f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_content_start.rs b/tests/generated/grid/grid_align_content_start.rs index 5794695eb..41f2f17fd 100644 --- a/tests/generated/grid/grid_align_content_start.rs +++ b/tests/generated/grid/grid_align_content_start.rs @@ -33,66 +33,398 @@ fn grid_align_content_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_align_content_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 103581b35..3316f5df7 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 @@ -54,72 +54,497 @@ fn grid_align_content_start_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_align_content_start_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node03, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node04, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node04, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node05, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node05, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node06, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node06, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node06, 20f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node06, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node07, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node07, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node07, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node08, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node08, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node08, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ee59f6670..b381e8842 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 @@ -45,66 +45,398 @@ fn grid_align_content_start_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_align_content_start_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_baseline.rs b/tests/generated/grid/grid_align_items_baseline.rs index 49d678320..151983c22 100644 --- a/tests/generated/grid/grid_align_items_baseline.rs +++ b/tests/generated/grid/grid_align_items_baseline.rs @@ -42,24 +42,125 @@ fn grid_align_items_baseline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,22 +210,123 @@ fn grid_align_items_baseline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_baseline_child.rs b/tests/generated/grid/grid_align_items_baseline_child.rs index cf6f62f1d..b5257a735 100644 --- a/tests/generated/grid/grid_align_items_baseline_child.rs +++ b/tests/generated/grid/grid_align_items_baseline_child.rs @@ -55,30 +55,170 @@ fn grid_align_items_baseline_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -142,28 +282,168 @@ fn grid_align_items_baseline_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d4398a68e..88e5180ad 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_margin.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_margin.rs @@ -67,30 +67,170 @@ fn grid_align_items_baseline_child_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -166,28 +306,168 @@ fn grid_align_items_baseline_child_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 526b7b957..9a2c566d9 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 @@ -67,30 +67,170 @@ fn grid_align_items_baseline_child_margin_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -166,28 +306,168 @@ fn grid_align_items_baseline_child_margin_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 1f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node10, 1f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node10, 1f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a47621acb..130497d54 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_multiline.rs @@ -81,48 +81,305 @@ fn grid_align_items_baseline_child_multiline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -215,46 +472,303 @@ fn grid_align_items_baseline_child_multiline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 937f485ff..d67fb6779 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 @@ -87,48 +87,305 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 8f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 8f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node1, 68f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -227,46 +484,303 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 8f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 8f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node1, 68f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 69df9f8cd..4ababf357 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 @@ -88,48 +88,305 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 8f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 8f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node1, 68f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -229,46 +486,303 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 8f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 8f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node1, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 68f32, "y of node {:?}. Expected {}. Actual {}", node1, 68f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 68f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 15f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node10, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node11, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node11, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node11, 25f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node11, 0f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node12, 25f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node12, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node12, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 25f32, "width of node {:?}. Expected {}. Actual {}", node13, 25f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node13, 10f32, size.height); - assert_eq!(location.x, 25f32, "x of node {:?}. Expected {}. Actual {}", node13, 25f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node13, 20f32, location.y); + if layout.size.width != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 25f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 25f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d2d3cc874..57dbb3d85 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_padding.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_padding.rs @@ -67,30 +67,170 @@ fn grid_align_items_baseline_child_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node1, 5f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 5f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 5f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -166,28 +306,168 @@ fn grid_align_items_baseline_child_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 110f32, "height of node {:?}. Expected {}. Actual {}", node, 110f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 110f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node1, 5f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node10, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node10, 5f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 adee38b87..83e231315 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top.rs @@ -56,30 +56,170 @@ fn grid_align_items_baseline_child_top__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -144,28 +284,168 @@ fn grid_align_items_baseline_child_top__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e66abd071..919b53851 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top2.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top2.rs @@ -56,30 +56,170 @@ fn grid_align_items_baseline_child_top2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -144,28 +284,168 @@ fn grid_align_items_baseline_child_top2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_baseline_complex.rs b/tests/generated/grid/grid_align_items_baseline_complex.rs index a467d6e2f..da27ecdb6 100644 --- a/tests/generated/grid/grid_align_items_baseline_complex.rs +++ b/tests/generated/grid/grid_align_items_baseline_complex.rs @@ -141,90 +141,572 @@ fn grid_align_items_baseline_complex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node20, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node6, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node60).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node60, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node60, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node60, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node60, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 95f32, "y of node {:?}. Expected {}. Actual {}", node7, 95f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 95f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node70).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node70, 0f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node70, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node70, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node70, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node70, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node70, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -384,88 +866,570 @@ fn grid_align_items_baseline_complex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node10, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node20, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node6, 90f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node60).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node60, 0f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node60, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node60, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node60, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node60, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node60, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 95f32, "y of node {:?}. Expected {}. Actual {}", node7, 95f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 95f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node70).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node70, 0f32, size.width); - assert_eq!(size.height, 5f32, "height of node {:?}. Expected {}. Actual {}", node70, 5f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node70, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node70, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(size.height), 5f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node70, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node70, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node70, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node8, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node8, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3445f29be..c2d8133d6 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 @@ -68,36 +68,215 @@ fn grid_align_items_baseline_double_nested_child__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -175,34 +354,213 @@ fn grid_align_items_baseline_double_nested_child__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 65f32, "y of node {:?}. Expected {}. Actual {}", node1, 65f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 65f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 15f32, "height of node {:?}. Expected {}. Actual {}", node10, 15f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 15f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 15f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_baseline_multiline.rs b/tests/generated/grid/grid_align_items_baseline_multiline.rs index 597b1fc65..f0600e199 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline.rs @@ -89,48 +89,293 @@ fn grid_align_items_baseline_multiline__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -231,46 +476,291 @@ fn grid_align_items_baseline_multiline__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node3, 60f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 eac61a600..9de404187 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline_column.rs @@ -89,48 +89,293 @@ fn grid_align_items_baseline_multiline_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 60f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -231,46 +476,291 @@ fn grid_align_items_baseline_multiline_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 60f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node1, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node10, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node10, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 70f32, "height of node {:?}. Expected {}. Actual {}", node2, 70f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node2, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 70f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node20, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5277890b5..10e270762 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 @@ -89,48 +89,293 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -231,46 +476,291 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node1, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node1, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node10, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node20).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node20, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node20, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node20, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node20, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node20, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node20, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node3, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node3, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8a226cdc8..97425e788 100644 --- a/tests/generated/grid/grid_align_items_baseline_nested_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_nested_column.rs @@ -71,42 +71,260 @@ fn grid_align_items_baseline_nested_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node10, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node100, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node101, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node101, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node101, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node101, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -191,40 +409,258 @@ fn grid_align_items_baseline_nested_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node1, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node10, 50f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node10, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node10, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node10, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 80f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node100, 50f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node100, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node100, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(size.height), + 30f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node100, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node101, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node101, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node101, 0f32, location.x); - assert_eq!(location.y, 35f32, "y of node {:?}. Expected {}. Actual {}", node101, 35f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node101, stringify!(location.y), 35f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_sized_center.rs b/tests/generated/grid/grid_align_items_sized_center.rs index 776f9e501..460e3f24b 100644 --- a/tests/generated/grid/grid_align_items_sized_center.rs +++ b/tests/generated/grid/grid_align_items_sized_center.rs @@ -46,24 +46,125 @@ fn grid_align_items_sized_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_align_items_sized_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 70f32, "y of node {:?}. Expected {}. Actual {}", node1, 70f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 70f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_sized_end.rs b/tests/generated/grid/grid_align_items_sized_end.rs index ecfbfc29e..59c36d747 100644 --- a/tests/generated/grid/grid_align_items_sized_end.rs +++ b/tests/generated/grid/grid_align_items_sized_end.rs @@ -46,24 +46,125 @@ fn grid_align_items_sized_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_align_items_sized_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node0, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node1, 60f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_sized_start.rs b/tests/generated/grid/grid_align_items_sized_start.rs index f2fc9ea50..4f002a3b2 100644 --- a/tests/generated/grid/grid_align_items_sized_start.rs +++ b/tests/generated/grid/grid_align_items_sized_start.rs @@ -46,24 +46,125 @@ fn grid_align_items_sized_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_align_items_sized_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_items_sized_stretch.rs b/tests/generated/grid/grid_align_items_sized_stretch.rs index b66e481fa..5b4e790d8 100644 --- a/tests/generated/grid/grid_align_items_sized_stretch.rs +++ b/tests/generated/grid/grid_align_items_sized_stretch.rs @@ -46,24 +46,125 @@ fn grid_align_items_sized_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_align_items_sized_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_align_self_sized_all.rs b/tests/generated/grid/grid_align_self_sized_all.rs index 86388b4ff..b5ff34169 100644 --- a/tests/generated/grid/grid_align_self_sized_all.rs +++ b/tests/generated/grid/grid_align_self_sized_all.rs @@ -103,60 +103,359 @@ fn grid_align_self_sized_all__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node3, 20f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -273,58 +572,357 @@ fn grid_align_self_sized_all__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node2, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node3, 20f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fb390e47d..80519d21d 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 @@ -34,18 +34,92 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__borde println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__conte println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node0, 360f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2606adaa5..5689989f1 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 @@ -34,18 +34,92 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +160,90 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 107f32, "height of node {:?}. Expected {}. Actual {}", node0, 107f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 107f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 107f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dbb53daf6..d2a921be0 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 @@ -29,18 +29,86 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -76,16 +144,84 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node0, 180f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node0, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3962fef49..8b2e6c092 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 @@ -30,18 +30,86 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node0, 90f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node0, 90f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 62d6813e5..5c2c52e71 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 @@ -35,18 +35,86 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 400f32, "width of node {:?}. Expected {}. Actual {}", node, 400f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 400f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 400f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 53f32, "height of node {:?}. Expected {}. Actual {}", node0, 53f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node0, 15f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 53f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 53f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 00c737d70..91a7ce27a 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 @@ -26,24 +26,125 @@ fn grid_aspect_ratio_child_fill_content_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -83,22 +184,123 @@ fn grid_aspect_ratio_child_fill_content_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node0, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 91ee8cb30..75d7ab091 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 @@ -26,24 +26,125 @@ fn grid_aspect_ratio_child_fill_content_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -83,22 +184,123 @@ fn grid_aspect_ratio_child_fill_content_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 eeace1b48..2db0b592b 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs @@ -28,18 +28,86 @@ fn grid_aspect_ratio_fill_child_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node0, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn grid_aspect_ratio_fill_child_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node0, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 54b6a2f7c..b19c99645 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 @@ -34,18 +34,86 @@ fn grid_aspect_ratio_fill_child_max_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -86,16 +154,84 @@ fn grid_aspect_ratio_fill_child_max_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 74d2cba42..8258f7203 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 @@ -31,18 +31,86 @@ fn grid_aspect_ratio_fill_child_max_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn grid_aspect_ratio_fill_child_max_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 82248e9c4..425ec90c4 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 @@ -28,18 +28,86 @@ fn grid_aspect_ratio_fill_child_min_height__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn grid_aspect_ratio_fill_child_min_height__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bc1edc250..45f971d99 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs @@ -28,18 +28,86 @@ fn grid_aspect_ratio_fill_child_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -74,16 +142,84 @@ fn grid_aspect_ratio_fill_child_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs index 35aca16ba..95a7538f8 100644 --- a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs +++ b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs @@ -31,18 +31,86 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs index 4e444c77c..b3f47192e 100644 --- a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs +++ b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs @@ -31,18 +31,86 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -80,16 +148,84 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_columns.rs b/tests/generated/grid/grid_auto_columns.rs index 060b9c578..a678abade 100644 --- a/tests/generated/grid/grid_auto_columns.rs +++ b/tests/generated/grid/grid_auto_columns.rs @@ -34,60 +34,407 @@ fn grid_auto_columns__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node, 190f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node5, 100f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node5, 130f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node6, 100f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node6, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node7, 100f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node7, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -142,58 +489,405 @@ fn grid_auto_columns__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node, 190f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node1, 100f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node2, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node2, 100f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node3, 100f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node4, 100f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node5, 100f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node5, 130f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node6, 100f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node6, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node7, 100f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node7, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_columns_fixed_width.rs b/tests/generated/grid/grid_auto_columns_fixed_width.rs index 4df554c98..0235ef95c 100644 --- a/tests/generated/grid/grid_auto_columns_fixed_width.rs +++ b/tests/generated/grid/grid_auto_columns_fixed_width.rs @@ -42,108 +42,707 @@ fn grid_auto_columns_fixed_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node3, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node4, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node6, 60f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node6, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node7, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node8, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node9, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node9, 40f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node9, 100f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node10, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node10, 100f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node10, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node11, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node11, 140f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node11, 100f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node12, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node12, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node12, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node13, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node13, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node13, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node13, 140f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node14, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node14, 60f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node14, 100f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node14, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node15, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node15, 60f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node15, 140f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node15, 140f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -223,106 +822,705 @@ fn grid_auto_columns_fixed_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node3, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node4, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node6, 60f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node6, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node7, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node8, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node9, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node9, 40f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node9, 100f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node10, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node10, 100f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node10, 100f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node11, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node11, 140f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node11, 100f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node12, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node12, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node12, 0f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node12, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node13, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node13, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node13, 40f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node13, 140f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node14).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node14, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node14, 60f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node14, 100f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node14, 140f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node14, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node14, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node15).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node15, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node15, 60f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node15, 140f32, location.x); - assert_eq!(location.y, 140f32, "y of node {:?}. Expected {}. Actual {}", node15, 140f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(size.height), + 60f32, + layout.size.height + ); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node15, stringify!(location.y), 140f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node15, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_fill_fixed_size.rs b/tests/generated/grid/grid_auto_fill_fixed_size.rs index a43e8de44..d6d26be54 100644 --- a/tests/generated/grid/grid_auto_fill_fixed_size.rs +++ b/tests/generated/grid/grid_auto_fill_fixed_size.rs @@ -32,66 +32,398 @@ fn grid_auto_fill_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_auto_fill_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cdb7d6134..cbcd367d3 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 @@ -26,24 +26,125 @@ fn grid_auto_fill_with_empty_auto_track__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,22 +180,123 @@ fn grid_auto_fill_with_empty_auto_track__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_fit_definite_percentage.rs b/tests/generated/grid/grid_auto_fit_definite_percentage.rs index 30620ea07..779c86263 100644 --- a/tests/generated/grid/grid_auto_fit_definite_percentage.rs +++ b/tests/generated/grid/grid_auto_fit_definite_percentage.rs @@ -57,66 +57,452 @@ fn grid_auto_fit_definite_percentage__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 730f32, "width of node {:?}. Expected {}. Actual {}", node, 730f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 730f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 730f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 730f32, "width of node {:?}. Expected {}. Actual {}", node0, 730f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node0, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 730f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 730f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 300f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node00, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node00, 135f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node01, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node01, 135f32, size.height); - assert_eq!(location.x, 190f32, "x of node {:?}. Expected {}. Actual {}", node01, 190f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 190f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node02, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node02, 135f32, size.height); - assert_eq!(location.x, 370f32, "x of node {:?}. Expected {}. Actual {}", node02, 370f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 370f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 370f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node03, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node03, 135f32, size.height); - assert_eq!(location.x, 550f32, "x of node {:?}. Expected {}. Actual {}", node03, 550f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 550f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 550f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node04, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node04, 135f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node04, 10f32, location.x); - assert_eq!(location.y, 155f32, "y of node {:?}. Expected {}. Actual {}", node04, 155f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 155f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 155f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node05, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node05, 135f32, size.height); - assert_eq!(location.x, 190f32, "x of node {:?}. Expected {}. Actual {}", node05, 190f32, location.x); - assert_eq!(location.y, 155f32, "y of node {:?}. Expected {}. Actual {}", node05, 155f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 190f32, layout.location.x); + } + if layout.location.y != 155f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 155f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node06, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node06, 135f32, size.height); - assert_eq!(location.x, 370f32, "x of node {:?}. Expected {}. Actual {}", node06, 370f32, location.x); - assert_eq!(location.y, 155f32, "y of node {:?}. Expected {}. Actual {}", node06, 155f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 370f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 370f32, layout.location.x); + } + if layout.location.y != 155f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 155f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node07, 170f32, size.width); - assert_eq!(size.height, 135f32, "height of node {:?}. Expected {}. Actual {}", node07, 135f32, size.height); - assert_eq!(location.x, 550f32, "x of node {:?}. Expected {}. Actual {}", node07, 550f32, location.x); - assert_eq!(location.y, 155f32, "y of node {:?}. Expected {}. Actual {}", node07, 155f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 135f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 135f32, + layout.size.height + ); + } + if layout.location.x != 550f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 550f32, layout.location.x); + } + if layout.location.y != 155f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 155f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -220,64 +606,450 @@ fn grid_auto_fit_definite_percentage__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 730f32, "width of node {:?}. Expected {}. Actual {}", node, 730f32, size.width); - assert_eq!(size.height, 300f32, "height of node {:?}. Expected {}. Actual {}", node, 300f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 730f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 730f32, layout.size.width); + } + if layout.size.height != 300f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 300f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 730f32, "width of node {:?}. Expected {}. Actual {}", node0, 730f32, size.width); - assert_eq!(size.height, 320f32, "height of node {:?}. Expected {}. Actual {}", node0, 320f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 730f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 730f32, layout.size.width); + } + if layout.size.height != 320f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 320f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node00, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node00, 145f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node00, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node00, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node01, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node01, 145f32, size.height); - assert_eq!(location.x, 190f32, "x of node {:?}. Expected {}. Actual {}", node01, 190f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node01, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 190f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node02, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node02, 145f32, size.height); - assert_eq!(location.x, 370f32, "x of node {:?}. Expected {}. Actual {}", node02, 370f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 370f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 370f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node03, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node03, 145f32, size.height); - assert_eq!(location.x, 550f32, "x of node {:?}. Expected {}. Actual {}", node03, 550f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 550f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 550f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node04, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node04, 145f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node04, 10f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node04, 165f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node05, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node05, 145f32, size.height); - assert_eq!(location.x, 190f32, "x of node {:?}. Expected {}. Actual {}", node05, 190f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node05, 165f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 190f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node06, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node06, 145f32, size.height); - assert_eq!(location.x, 370f32, "x of node {:?}. Expected {}. Actual {}", node06, 370f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node06, 165f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 370f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 370f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 170f32, "width of node {:?}. Expected {}. Actual {}", node07, 170f32, size.width); - assert_eq!(size.height, 145f32, "height of node {:?}. Expected {}. Actual {}", node07, 145f32, size.height); - assert_eq!(location.x, 550f32, "x of node {:?}. Expected {}. Actual {}", node07, 550f32, location.x); - assert_eq!(location.y, 165f32, "y of node {:?}. Expected {}. Actual {}", node07, 165f32, location.y); + if layout.size.width != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 170f32, layout.size.width); + } + if layout.size.height != 145f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 145f32, + layout.size.height + ); + } + if layout.location.x != 550f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 550f32, layout.location.x); + } + if layout.location.y != 165f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 165f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 438eba302..bde8634ec 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 @@ -26,24 +26,125 @@ fn grid_auto_fit_with_empty_auto_track__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,22 +180,123 @@ fn grid_auto_fit_with_empty_auto_track__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 67f32, "x of node {:?}. Expected {}. Actual {}", node1, 67f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 67f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_rows.rs b/tests/generated/grid/grid_auto_rows.rs index 0f4818d5c..713807ffb 100644 --- a/tests/generated/grid/grid_auto_rows.rs +++ b/tests/generated/grid/grid_auto_rows.rs @@ -33,60 +33,359 @@ fn grid_auto_rows__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node, 180f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 180f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node4, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node5, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node5, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node5, 120f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node6, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node6, 150f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,58 +439,357 @@ fn grid_auto_rows__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 180f32, "height of node {:?}. Expected {}. Actual {}", node, 180f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 180f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node3, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node3, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node3, 90f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node4, 100f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node5, 100f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node5, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node5, 120f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node6, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 150f32, "y of node {:?}. Expected {}. Actual {}", node6, 150f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 150f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node7, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node7, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_auto_single_item.rs b/tests/generated/grid/grid_auto_single_item.rs index a30100eed..21c9c8482 100644 --- a/tests/generated/grid/grid_auto_single_item.rs +++ b/tests/generated/grid/grid_auto_single_item.rs @@ -33,66 +33,398 @@ fn grid_auto_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,64 +480,396 @@ fn grid_auto_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5ef7ed647..fa619f4d6 100644 --- a/tests/generated/grid/grid_auto_single_item_fixed_width.rs +++ b/tests/generated/grid/grid_auto_single_item_fixed_width.rs @@ -34,66 +34,398 @@ fn grid_auto_single_item_fixed_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node1, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node2, 170f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node4, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node5, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node5, 170f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node7, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node8, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node8, 170f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -150,64 +482,396 @@ fn grid_auto_single_item_fixed_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node1, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node2, 170f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node4, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node5, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node5, 170f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node7, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node8, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node8, 170f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ac9d0cfb9..0644ad5b0 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 @@ -34,66 +34,398 @@ fn grid_auto_single_item_fixed_width_with_definite_width__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node2, 170f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node4, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node5, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node5, 170f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node7, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node8, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node8, 170f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -150,64 +482,396 @@ fn grid_auto_single_item_fixed_width_with_definite_width__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node2, 170f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node4, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node5, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node5, 170f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 130f32, "width of node {:?}. Expected {}. Actual {}", node7, 130f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 130f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node8, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 170f32, "x of node {:?}. Expected {}. Actual {}", node8, 170f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 170f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 170f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 16b095d49..a169755d8 100644 --- a/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs +++ b/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs @@ -25,24 +25,125 @@ fn grid_auto_takes_precedence_over_fr__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -77,22 +178,123 @@ fn grid_auto_takes_precedence_over_fr__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 faa668505..945a3e975 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 @@ -39,24 +39,125 @@ fn grid_available_space_greater_than_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node1, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn grid_available_space_greater_than_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node1, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5649024bc..c1fe7d454 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 @@ -39,24 +39,125 @@ fn grid_available_space_smaller_than_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn grid_available_space_smaller_than_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d59cb1695..cd9b24f32 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 @@ -39,24 +39,125 @@ fn grid_available_space_smaller_than_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +202,123 @@ fn grid_available_space_smaller_than_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_basic.rs b/tests/generated/grid/grid_basic.rs index 746bffdbf..c4293f16a 100644 --- a/tests/generated/grid/grid_basic.rs +++ b/tests/generated/grid/grid_basic.rs @@ -32,66 +32,398 @@ fn grid_basic__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_basic__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_basic_implicit_tracks.rs b/tests/generated/grid/grid_basic_implicit_tracks.rs index 1eed031de..8f09fa873 100644 --- a/tests/generated/grid/grid_basic_implicit_tracks.rs +++ b/tests/generated/grid/grid_basic_implicit_tracks.rs @@ -29,24 +29,125 @@ fn grid_basic_implicit_tracks__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node, 75f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node1, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node1, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,22 +185,123 @@ fn grid_basic_implicit_tracks__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 75f32, "height of node {:?}. Expected {}. Actual {}", node, 75f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 75f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 75f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node1, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node1, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_basic_with_overflow.rs b/tests/generated/grid/grid_basic_with_overflow.rs index 77032fea5..25abeacf3 100644 --- a/tests/generated/grid/grid_basic_with_overflow.rs +++ b/tests/generated/grid/grid_basic_with_overflow.rs @@ -33,72 +33,437 @@ fn grid_basic_with_overflow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node9, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node9, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node9, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node9, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -157,70 +522,435 @@ fn grid_basic_with_overflow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node9, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node9, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node9, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node9, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_basic_with_padding.rs b/tests/generated/grid/grid_basic_with_padding.rs index 88575cc1e..75bd5f780 100644 --- a/tests/generated/grid/grid_basic_with_padding.rs +++ b/tests/generated/grid/grid_basic_with_padding.rs @@ -34,66 +34,398 @@ fn grid_basic_with_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node6, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -151,64 +483,396 @@ fn grid_basic_with_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node6, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_display_none_fixed_size.rs b/tests/generated/grid/grid_display_none_fixed_size.rs index 73e77a4d7..8278238a4 100644 --- a/tests/generated/grid/grid_display_none_fixed_size.rs +++ b/tests/generated/grid/grid_display_none_fixed_size.rs @@ -32,24 +32,131 @@ fn grid_display_none_fixed_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,22 +201,129 @@ fn grid_display_none_fixed_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e14b306b0..412dacdd8 100644 --- a/tests/generated/grid/grid_fit_content_percent_definite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_definite_argument.rs @@ -26,18 +26,86 @@ fn grid_fit_content_percent_definite_argument__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_fit_content_percent_definite_argument__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 19178629a..743d80efa 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 @@ -26,18 +26,86 @@ fn grid_fit_content_percent_definite_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_fit_content_percent_definite_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2f6dff85a..16dd305ee 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 @@ -26,18 +26,86 @@ fn grid_fit_content_percent_definite_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_fit_content_percent_definite_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cd298e136..07252bc64 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs @@ -25,18 +25,86 @@ fn grid_fit_content_percent_indefinite_argument__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_percent_indefinite_argument__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bf03d5a7b..932222701 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 @@ -25,18 +25,86 @@ fn grid_fit_content_percent_indefinite_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_percent_indefinite_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ddb406565..00efa88d1 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 @@ -32,36 +32,86 @@ fn grid_fit_content_percent_indefinite_max_content_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,34 +150,84 @@ fn grid_fit_content_percent_indefinite_max_content_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e8c7dce00..adf61a2ee 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 @@ -25,18 +25,86 @@ fn grid_fit_content_percent_indefinite_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_percent_indefinite_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 24de61f62..0afc3db17 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 @@ -32,36 +32,86 @@ fn grid_fit_content_percent_indefinite_min_content_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,34 +150,84 @@ fn grid_fit_content_percent_indefinite_min_content_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_fit_content_points_argument.rs b/tests/generated/grid/grid_fit_content_points_argument.rs index ed804485e..5a6020da2 100644 --- a/tests/generated/grid/grid_fit_content_points_argument.rs +++ b/tests/generated/grid/grid_fit_content_points_argument.rs @@ -25,18 +25,86 @@ fn grid_fit_content_points_argument__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_points_argument__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 71391871c..0a4daea67 100644 --- a/tests/generated/grid/grid_fit_content_points_max_content.rs +++ b/tests/generated/grid/grid_fit_content_points_max_content.rs @@ -25,18 +25,86 @@ fn grid_fit_content_points_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_points_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8411c8fe7..11de9ccee 100644 --- a/tests/generated/grid/grid_fit_content_points_min_content.rs +++ b/tests/generated/grid/grid_fit_content_points_min_content.rs @@ -25,18 +25,86 @@ fn grid_fit_content_points_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_fit_content_points_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bdfe88445..ec4a4a4d6 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 @@ -32,36 +32,86 @@ fn grid_fit_content_points_min_content_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -100,34 +150,84 @@ fn grid_fit_content_points_min_content_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 10f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 10f32, - layout.scroll_width() - ); + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e37319ff4..38bc0a430 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 @@ -23,30 +23,164 @@ fn grid_fr_fixed_size_no_content_proportions__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node1, 67f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node1, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -81,28 +215,162 @@ fn grid_fr_fixed_size_no_content_proportions__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 33f32, "width of node {:?}. Expected {}. Actual {}", node0, 33f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 33f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 67f32, "width of node {:?}. Expected {}. Actual {}", node1, 67f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 33f32, "x of node {:?}. Expected {}. Actual {}", node1, 33f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 33f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 33f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 36df94bdc..947dc6f73 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 @@ -22,24 +22,125 @@ fn grid_fr_fixed_size_no_content_proportions_sub_1_sum__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,22 +172,123 @@ fn grid_fr_fixed_size_no_content_proportions_sub_1_sum__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node0, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node1, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 95117686b..61c4701cb 100644 --- a/tests/generated/grid/grid_fr_fixed_size_single_item.rs +++ b/tests/generated/grid/grid_fr_fixed_size_single_item.rs @@ -37,66 +37,398 @@ fn grid_fr_fixed_size_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node3, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node4, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node5, 80f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node6, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node7, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node7, 120f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node8, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node8, 80f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -156,64 +488,396 @@ fn grid_fr_fixed_size_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node2, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node3, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node4, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node5, 80f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node6, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node6, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node7, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node7, 120f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node8, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node8, 80f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5ec030fe6..8a2d354fe 100644 --- a/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs +++ b/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs @@ -28,66 +28,398 @@ fn grid_fr_no_sized_items_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node5, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node7, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node7, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node8, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -139,64 +471,396 @@ fn grid_fr_no_sized_items_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node5, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node7, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node7, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node8, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node8, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_fr_single_item_indefinite.rs b/tests/generated/grid/grid_fr_single_item_indefinite.rs index 10423fb81..ea69361cf 100644 --- a/tests/generated/grid/grid_fr_single_item_indefinite.rs +++ b/tests/generated/grid/grid_fr_single_item_indefinite.rs @@ -37,66 +37,398 @@ fn grid_fr_single_item_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node5, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node7, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node8, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -156,64 +488,396 @@ fn grid_fr_single_item_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node1, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node2, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node4, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node5, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node7, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node7, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node8, 100f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_fr_span_2_proportion.rs b/tests/generated/grid/grid_fr_span_2_proportion.rs index 476423fdd..507d7e0e6 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion.rs @@ -31,30 +31,164 @@ fn grid_fr_span_2_proportion__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,28 +230,162 @@ fn grid_fr_span_2_proportion__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node2, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8d1e7b99c..83bba63a7 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 @@ -31,30 +31,164 @@ fn grid_fr_span_2_proportion_sub_1_sum__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node1, 24f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node2, 36f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 24f32, "x of node {:?}. Expected {}. Actual {}", node2, 24f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 24f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,28 +230,162 @@ fn grid_fr_span_2_proportion_sub_1_sum__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node1, 24f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node2, 36f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 24f32, "x of node {:?}. Expected {}. Actual {}", node2, 24f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 24f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 83894b0d2..0ae0f871f 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 @@ -33,42 +33,242 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node4, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,40 +316,240 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node4, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 bdff8e561..1b331bab7 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 @@ -31,30 +31,164 @@ fn grid_fr_span_2_proportion_zero_sum__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node2, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,28 +230,162 @@ fn grid_fr_span_2_proportion_zero_sum__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node2, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0cd7b7798..20b17622b 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 @@ -33,42 +33,242 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,40 +316,240 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_gap.rs b/tests/generated/grid/grid_gap.rs index 577738211..220a71924 100644 --- a/tests/generated/grid/grid_gap.rs +++ b/tests/generated/grid/grid_gap.rs @@ -33,66 +33,398 @@ fn grid_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node3, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node4, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node6, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node7, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 160f32, "y of node {:?}. Expected {}. Actual {}", node8, 160f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 160f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_hidden.rs b/tests/generated/grid/grid_hidden.rs index a7a138733..1501f8383 100644 --- a/tests/generated/grid/grid_hidden.rs +++ b/tests/generated/grid/grid_hidden.rs @@ -35,66 +35,398 @@ fn grid_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node6, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node6, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node6, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node6, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_inflow_overflow_clip.rs b/tests/generated/grid/grid_inflow_overflow_clip.rs new file mode 100644 index 000000000..7d2c1daf1 --- /dev/null +++ b/tests/generated/grid/grid_inflow_overflow_clip.rs @@ -0,0 +1,275 @@ +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 68f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 68f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 46f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 46f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_inflow_overflow_hidden.rs b/tests/generated/grid/grid_inflow_overflow_hidden.rs new file mode 100644 index 000000000..eba5bdc84 --- /dev/null +++ b/tests/generated/grid/grid_inflow_overflow_hidden.rs @@ -0,0 +1,281 @@ +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 72f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 72f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 64f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 64f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 50f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_inflow_overflow_scroll.rs b/tests/generated/grid/grid_inflow_overflow_scroll.rs new file mode 100644 index 000000000..4ffb4fb88 --- /dev/null +++ b/tests/generated/grid/grid_inflow_overflow_scroll.rs @@ -0,0 +1,281 @@ +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 87f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 87f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 79f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 79f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 65f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_inflow_overflow_visible.rs b/tests/generated/grid/grid_inflow_overflow_visible.rs new file mode 100644 index 000000000..8db82497c --- /dev/null +++ b/tests/generated/grid/grid_inflow_overflow_visible.rs @@ -0,0 +1,271 @@ +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 68f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 68f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 58f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 58f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn grid_inflow_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node0 = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(100f32), + height: taffy::style::Dimension::from_length(100f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text("", crate::WritingMode::Horizontal), + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(50f32), + height: taffy::style::Dimension::from_length(50f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 72f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 72f32, layout.size.width); + } + if layout.size.height != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 64f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 46f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 46f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + let layout = taffy.layout(node0).unwrap(); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/grid/grid_justify_content_center.rs b/tests/generated/grid/grid_justify_content_center.rs index d10abc097..a4dd4d61d 100644 --- a/tests/generated/grid/grid_justify_content_center.rs +++ b/tests/generated/grid/grid_justify_content_center.rs @@ -33,66 +33,398 @@ fn grid_justify_content_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 684a33cf9..e3ece1d6d 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 @@ -54,72 +54,497 @@ fn grid_justify_content_center_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node00, -10f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node02, 90f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node03, -10f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node04, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node05, 90f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node06, -10f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node07, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node08, 90f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_center_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node00, -10f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node02, 90f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node03, -10f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node04, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node05, 90f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, -10f32, "x of node {:?}. Expected {}. Actual {}", node06, -10f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), -10f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node07, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node08, 90f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 90f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 04e57a1f2..b7fdd1062 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 @@ -45,66 +45,398 @@ fn grid_justify_content_center_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node0, 52f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node1, 92f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 132f32, "x of node {:?}. Expected {}. Actual {}", node2, 132f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 132f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node3, 52f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node4, 92f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 132f32, "x of node {:?}. Expected {}. Actual {}", node5, 132f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 132f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node6, 52f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node7, 92f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 132f32, "x of node {:?}. Expected {}. Actual {}", node8, 132f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 132f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 132f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_center_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node0, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node1, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node2, 168f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node3, 88f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node4, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node5, 168f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node6, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node7, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node8, 168f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_content_end.rs b/tests/generated/grid/grid_justify_content_end.rs index 9eda790ff..b7311ece3 100644 --- a/tests/generated/grid/grid_justify_content_end.rs +++ b/tests/generated/grid/grid_justify_content_end.rs @@ -33,66 +33,398 @@ fn grid_justify_content_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node1, 120f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node4, 120f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node7, 120f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0ce55253f..cbdc45bd9 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 @@ -54,72 +54,497 @@ fn grid_justify_content_end_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node00, -20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node03, -20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node04, 30f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node06, -20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node07, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_end_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node00, -20f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node01, 30f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node02, 80f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node03, -20f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node04, 30f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node05, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node06, -20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node07, 30f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node08, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 cb369f0b8..7509fce51 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 @@ -45,66 +45,398 @@ fn grid_justify_content_end_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 56f32, "x of node {:?}. Expected {}. Actual {}", node0, 56f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 56f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node1, 96f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node2, 136f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 56f32, "x of node {:?}. Expected {}. Actual {}", node3, 56f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 56f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node4, 96f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node5, 136f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 56f32, "x of node {:?}. Expected {}. Actual {}", node6, 56f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 56f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 56f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node7, 96f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node8, 136f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_end_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node0, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node1, 168f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node2, 208f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node3, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node4, 168f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node5, 208f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node6, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 168f32, "x of node {:?}. Expected {}. Actual {}", node7, 168f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 168f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 168f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node8, 208f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_content_space_around.rs b/tests/generated/grid/grid_justify_content_space_around.rs index be1042c89..6c01a9e64 100644 --- a/tests/generated/grid/grid_justify_content_space_around.rs +++ b/tests/generated/grid/grid_justify_content_space_around.rs @@ -33,66 +33,398 @@ fn grid_justify_content_space_around__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node2, 147f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node3, 13f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node5, 147f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node6, 13f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node8, 147f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_space_around__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node2, 147f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node3, 13f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node5, 147f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node6, 13f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 147f32, "x of node {:?}. Expected {}. Actual {}", node8, 147f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 147f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 147f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a34d4d16a..47739029c 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 @@ -54,72 +54,497 @@ fn grid_justify_content_space_around_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_space_around_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8971a709e..57260263c 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 @@ -45,66 +45,398 @@ fn grid_justify_content_space_around_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 49f32, "x of node {:?}. Expected {}. Actual {}", node0, 49f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 49f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node1, 92f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node2, 135f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 49f32, "x of node {:?}. Expected {}. Actual {}", node3, 49f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 49f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node4, 92f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node5, 135f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 49f32, "x of node {:?}. Expected {}. Actual {}", node6, 49f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 49f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node7, 92f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 135f32, "x of node {:?}. Expected {}. Actual {}", node8, 135f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 135f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 135f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_space_around_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 61f32, "x of node {:?}. Expected {}. Actual {}", node0, 61f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 61f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node1, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node2, 195f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 61f32, "x of node {:?}. Expected {}. Actual {}", node3, 61f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 61f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node4, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node5, 195f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 61f32, "x of node {:?}. Expected {}. Actual {}", node6, 61f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 61f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 61f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node7, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node8, 195f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_content_space_between.rs b/tests/generated/grid/grid_justify_content_space_between.rs index b71fe6fe3..0d3e15541 100644 --- a/tests/generated/grid/grid_justify_content_space_between.rs +++ b/tests/generated/grid/grid_justify_content_space_between.rs @@ -33,66 +33,398 @@ fn grid_justify_content_space_between__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_space_between__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node2, 160f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node5, 160f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 160f32, "x of node {:?}. Expected {}. Actual {}", node8, 160f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 160f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 50dc26f9a..ca0daf34f 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 @@ -54,72 +54,497 @@ fn grid_justify_content_space_between_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_space_between_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8a55a815d..6e280214f 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 @@ -45,66 +45,398 @@ fn grid_justify_content_space_between_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node1, 92f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node2, 136f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node4, 92f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node5, 136f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node7, 92f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 136f32, "x of node {:?}. Expected {}. Actual {}", node8, 136f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 136f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 136f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_space_between_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node1, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node2, 208f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node4, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node5, 208f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node7, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 208f32, "x of node {:?}. Expected {}. Actual {}", node8, 208f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 208f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 208f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_content_space_evenly.rs b/tests/generated/grid/grid_justify_content_space_evenly.rs index 715b30d0b..6068c8edd 100644 --- a/tests/generated/grid/grid_justify_content_space_evenly.rs +++ b/tests/generated/grid/grid_justify_content_space_evenly.rs @@ -33,66 +33,398 @@ fn grid_justify_content_space_evenly__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node6, 20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_space_evenly__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node2, 140f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node3, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node5, 140f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node6, 20f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 140f32, "x of node {:?}. Expected {}. Actual {}", node8, 140f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 140f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 70289b6d1..e344556c6 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 @@ -54,72 +54,497 @@ fn grid_justify_content_space_evenly_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_space_evenly_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2d5024b13..c55f1ff27 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 @@ -45,66 +45,398 @@ fn grid_justify_content_space_evenly_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node0, 50f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node1, 92f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 134f32, "x of node {:?}. Expected {}. Actual {}", node2, 134f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 134f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 134f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node3, 50f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node4, 92f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 134f32, "x of node {:?}. Expected {}. Actual {}", node5, 134f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 134f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 134f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node6, 50f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 92f32, "x of node {:?}. Expected {}. Actual {}", node7, 92f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 92f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 134f32, "x of node {:?}. Expected {}. Actual {}", node8, 134f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 134f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 134f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_space_evenly_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 68f32, "x of node {:?}. Expected {}. Actual {}", node0, 68f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 68f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node1, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 188f32, "x of node {:?}. Expected {}. Actual {}", node2, 188f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 188f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 68f32, "x of node {:?}. Expected {}. Actual {}", node3, 68f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 68f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node4, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 188f32, "x of node {:?}. Expected {}. Actual {}", node5, 188f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 188f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 68f32, "x of node {:?}. Expected {}. Actual {}", node6, 68f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 68f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 68f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node7, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 188f32, "x of node {:?}. Expected {}. Actual {}", node8, 188f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 188f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 188f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_content_start.rs b/tests/generated/grid/grid_justify_content_start.rs index 5327c11c7..bc4e9e719 100644 --- a/tests/generated/grid/grid_justify_content_start.rs +++ b/tests/generated/grid/grid_justify_content_start.rs @@ -33,66 +33,398 @@ fn grid_justify_content_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,64 +481,396 @@ fn grid_justify_content_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 87bbd6af9..4d18151a4 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 @@ -54,72 +54,497 @@ fn grid_justify_content_start_negative_space_gap__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 240f32, "width of node {:?}. Expected {}. Actual {}", node, 240f32, size.width); - assert_eq!(size.height, 240f32, "height of node {:?}. Expected {}. Actual {}", node, 240f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 240f32, layout.size.width); + } + if layout.size.height != 240f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 240f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -198,70 +623,495 @@ fn grid_justify_content_start_negative_space_gap__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 360f32, "width of node {:?}. Expected {}. Actual {}", node, 360f32, size.width); - assert_eq!(size.height, 360f32, "height of node {:?}. Expected {}. Actual {}", node, 360f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 360f32, layout.size.width); + } + if layout.size.height != 360f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 360f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node0, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node0, 120f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node0, 60f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node0, 60f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 120f32, + layout.size.height + ); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node00, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node02, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node02, 100f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node02, 20f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node03, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node03, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node03, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node03, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node04).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node04, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node04, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node04, 50f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node04, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node04, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node04, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node05).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node05, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node05, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node05, 100f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node05, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node05, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node05, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node06).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node06, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node06, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node06, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node06, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node06, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node06, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node07).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node07, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node07, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node07, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node07, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node07, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node07, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node08).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node08, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node08, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node08, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node08, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node08, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node08, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8f531a0e5..0f0dc59c1 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 @@ -45,66 +45,398 @@ fn grid_justify_content_start_with_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -173,64 +505,396 @@ fn grid_justify_content_start_with_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 272f32, "width of node {:?}. Expected {}. Actual {}", node, 272f32, size.width); - assert_eq!(size.height, 248f32, "height of node {:?}. Expected {}. Actual {}", node, 248f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 272f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 272f32, layout.size.width); + } + if layout.size.height != 248f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 248f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node0, 48f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node0, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node1, 88f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node1, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node2, 128f32, location.x); - assert_eq!(location.y, 12f32, "y of node {:?}. Expected {}. Actual {}", node2, 12f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 12f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node3, 48f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node3, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node4, 88f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node4, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node5, 128f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node5, 52f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node6, 48f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node6, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 88f32, "x of node {:?}. Expected {}. Actual {}", node7, 88f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node7, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 88f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 88f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node8, 128f32, location.x); - assert_eq!(location.y, 92f32, "y of node {:?}. Expected {}. Actual {}", node8, 92f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 92f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_items_sized_center.rs b/tests/generated/grid/grid_justify_items_sized_center.rs index 61a10d4d6..0b640d2ac 100644 --- a/tests/generated/grid/grid_justify_items_sized_center.rs +++ b/tests/generated/grid/grid_justify_items_sized_center.rs @@ -46,24 +46,125 @@ fn grid_justify_items_sized_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_justify_items_sized_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node1, 70f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_items_sized_end.rs b/tests/generated/grid/grid_justify_items_sized_end.rs index 6ab39f704..0cfa7bd05 100644 --- a/tests/generated/grid/grid_justify_items_sized_end.rs +++ b/tests/generated/grid/grid_justify_items_sized_end.rs @@ -46,24 +46,125 @@ fn grid_justify_items_sized_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_justify_items_sized_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node0, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_items_sized_start.rs b/tests/generated/grid/grid_justify_items_sized_start.rs index 469beabcc..3d70fd77a 100644 --- a/tests/generated/grid/grid_justify_items_sized_start.rs +++ b/tests/generated/grid/grid_justify_items_sized_start.rs @@ -46,24 +46,125 @@ fn grid_justify_items_sized_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_justify_items_sized_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_items_sized_stretch.rs b/tests/generated/grid/grid_justify_items_sized_stretch.rs index d9d4d0e8a..3ad2494eb 100644 --- a/tests/generated/grid/grid_justify_items_sized_stretch.rs +++ b/tests/generated/grid/grid_justify_items_sized_stretch.rs @@ -46,24 +46,125 @@ fn grid_justify_items_sized_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,22 +218,123 @@ fn grid_justify_items_sized_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_justify_self_sized_all.rs b/tests/generated/grid/grid_justify_self_sized_all.rs index 1101aac93..6e74512ed 100644 --- a/tests/generated/grid/grid_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_justify_self_sized_all.rs @@ -103,60 +103,359 @@ fn grid_justify_self_sized_all__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node3, -20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node5, 70f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -273,58 +572,357 @@ fn grid_justify_self_sized_all__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node1, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node2, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node3, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node3, 60f32, size.height); - assert_eq!(location.x, -20f32, "x of node {:?}. Expected {}. Actual {}", node3, -20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != -20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), -20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node4, 50f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node5, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node5, 70f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node7, 60f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node7, 60f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_auto_margins.rs b/tests/generated/grid/grid_margins_auto_margins.rs index 2776bf79b..c581cac35 100644 --- a/tests/generated/grid/grid_margins_auto_margins.rs +++ b/tests/generated/grid/grid_margins_auto_margins.rs @@ -74,66 +74,398 @@ fn grid_margins_auto_margins__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node2, 130f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node4, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node6, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node6, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -228,64 +560,396 @@ fn grid_margins_auto_margins__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 130f32, "x of node {:?}. Expected {}. Actual {}", node2, 130f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 130f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 130f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 60f32, "y of node {:?}. Expected {}. Actual {}", node4, 60f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 60f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node6, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node6, 50f32, location.x); - assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node6, 100f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 100f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 59c434b1a..151900d37 100644 --- a/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs +++ b/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs @@ -49,66 +49,398 @@ fn grid_margins_auto_margins_override_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 105f32, "y of node {:?}. Expected {}. Actual {}", node6, 105f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 105f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 105f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -180,64 +512,396 @@ fn grid_margins_auto_margins_override_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node6, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 105f32, "y of node {:?}. Expected {}. Actual {}", node6, 105f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 105f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 105f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node7, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node8, 120f32, location.x); - assert_eq!(location.y, 90f32, "y of node {:?}. Expected {}. Actual {}", node8, 90f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 90f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_fixed_center.rs b/tests/generated/grid/grid_margins_fixed_center.rs index fe60c1b9b..7660c12b7 100644 --- a/tests/generated/grid/grid_margins_fixed_center.rs +++ b/tests/generated/grid/grid_margins_fixed_center.rs @@ -47,48 +47,281 @@ fn grid_margins_fixed_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node0, 52f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,46 +385,279 @@ fn grid_margins_fixed_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 52f32, "x of node {:?}. Expected {}. Actual {}", node0, 52f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node0, 18f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 52f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_fixed_end.rs b/tests/generated/grid/grid_margins_fixed_end.rs index 56d79e053..395adf15c 100644 --- a/tests/generated/grid/grid_margins_fixed_end.rs +++ b/tests/generated/grid/grid_margins_fixed_end.rs @@ -47,48 +47,281 @@ fn grid_margins_fixed_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 58f32, "x of node {:?}. Expected {}. Actual {}", node0, 58f32, location.x); - assert_eq!(location.y, 27f32, "y of node {:?}. Expected {}. Actual {}", node0, 27f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 58f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 58f32, layout.location.x); + } + if layout.location.y != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 27f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,46 +385,279 @@ fn grid_margins_fixed_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 58f32, "x of node {:?}. Expected {}. Actual {}", node0, 58f32, location.x); - assert_eq!(location.y, 27f32, "y of node {:?}. Expected {}. Actual {}", node0, 27f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 58f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 58f32, layout.location.x); + } + if layout.location.y != 27f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 27f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_fixed_start.rs b/tests/generated/grid/grid_margins_fixed_start.rs index 846faa45a..c0d09cf64 100644 --- a/tests/generated/grid/grid_margins_fixed_start.rs +++ b/tests/generated/grid/grid_margins_fixed_start.rs @@ -47,48 +47,281 @@ fn grid_margins_fixed_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,46 +385,279 @@ fn grid_margins_fixed_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_fixed_stretch.rs b/tests/generated/grid/grid_margins_fixed_stretch.rs index 28cefc25e..17144eb9e 100644 --- a/tests/generated/grid/grid_margins_fixed_stretch.rs +++ b/tests/generated/grid/grid_margins_fixed_stretch.rs @@ -47,48 +47,281 @@ fn grid_margins_fixed_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -152,46 +385,279 @@ fn grid_margins_fixed_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 180f32, "width of node {:?}. Expected {}. Actual {}", node, 180f32, size.width); - assert_eq!(size.height, 160f32, "height of node {:?}. Expected {}. Actual {}", node, 160f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 180f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 180f32, layout.size.width); + } + if layout.size.height != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 160f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 44f32, "x of node {:?}. Expected {}. Actual {}", node0, 44f32, location.x); - assert_eq!(location.y, 11f32, "y of node {:?}. Expected {}. Actual {}", node0, 11f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 44f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 44f32, layout.location.x); + } + if layout.location.y != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node1, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node2, 120f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node2, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node3, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 120f32, "x of node {:?}. Expected {}. Actual {}", node5, 120f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 120f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_percent_center.rs b/tests/generated/grid/grid_margins_percent_center.rs index 3af648582..e231b5b06 100644 --- a/tests/generated/grid/grid_margins_percent_center.rs +++ b/tests/generated/grid/grid_margins_percent_center.rs @@ -41,48 +41,281 @@ fn grid_margins_percent_center__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 9f32, "y of node {:?}. Expected {}. Actual {}", node0, 9f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 9f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,46 +373,279 @@ fn grid_margins_percent_center__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 1f32, "x of node {:?}. Expected {}. Actual {}", node0, 1f32, location.x); - assert_eq!(location.y, 9f32, "y of node {:?}. Expected {}. Actual {}", node0, 9f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 1f32, layout.location.x); + } + if layout.location.y != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 9f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_percent_end.rs b/tests/generated/grid/grid_margins_percent_end.rs index af83c42b8..7f4836d13 100644 --- a/tests/generated/grid/grid_margins_percent_end.rs +++ b/tests/generated/grid/grid_margins_percent_end.rs @@ -41,48 +41,281 @@ fn grid_margins_percent_end__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, -2f32, "x of node {:?}. Expected {}. Actual {}", node0, -2f32, location.x); - assert_eq!(location.y, 17f32, "y of node {:?}. Expected {}. Actual {}", node0, 17f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != -2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -2f32, layout.location.x); + } + if layout.location.y != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 17f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,46 +373,279 @@ fn grid_margins_percent_end__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, -2f32, "x of node {:?}. Expected {}. Actual {}", node0, -2f32, location.x); - assert_eq!(location.y, 17f32, "y of node {:?}. Expected {}. Actual {}", node0, 17f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != -2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), -2f32, layout.location.x); + } + if layout.location.y != 17f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 17f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_percent_start.rs b/tests/generated/grid/grid_margins_percent_start.rs index 2516fd601..7362d12a2 100644 --- a/tests/generated/grid/grid_margins_percent_start.rs +++ b/tests/generated/grid/grid_margins_percent_start.rs @@ -41,48 +41,281 @@ fn grid_margins_percent_start__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,46 +373,279 @@ fn grid_margins_percent_start__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_margins_percent_stretch.rs b/tests/generated/grid/grid_margins_percent_stretch.rs index 1bf0f9ca8..4236e6dd7 100644 --- a/tests/generated/grid/grid_margins_percent_stretch.rs +++ b/tests/generated/grid/grid_margins_percent_stretch.rs @@ -41,48 +41,281 @@ fn grid_margins_percent_stretch__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -140,46 +373,279 @@ fn grid_margins_percent_stretch__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 4f32, "x of node {:?}. Expected {}. Actual {}", node0, 4f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node0, 1f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 4f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node4, 20f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e74e10d7a..6840d08b1 100644 --- a/tests/generated/grid/grid_max_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_max_content_maximum_single_item.rs @@ -33,66 +33,398 @@ fn grid_max_content_maximum_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_max_content_maximum_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_max_content_single_item.rs b/tests/generated/grid/grid_max_content_single_item.rs index e79eb874c..388185111 100644 --- a/tests/generated/grid/grid_max_content_single_item.rs +++ b/tests/generated/grid/grid_max_content_single_item.rs @@ -33,66 +33,398 @@ fn grid_max_content_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_max_content_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e9ef47ec5..c03689373 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 @@ -41,66 +41,398 @@ fn grid_max_content_single_item_margin_auto__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_max_content_single_item_margin_auto__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node1, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 15f32, "y of node {:?}. Expected {}. Actual {}", node1, 15f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 15f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3ec8c33e6..9829d5f52 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 @@ -41,66 +41,398 @@ fn grid_max_content_single_item_margin_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node2, 110f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node4, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node5, 110f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node7, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node8, 110f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_max_content_single_item_margin_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 150f32, "width of node {:?}. Expected {}. Actual {}", node, 150f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 150f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 150f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node2, 110f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node4, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node5, 110f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node7, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 110f32, "x of node {:?}. Expected {}. Actual {}", node8, 110f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 110f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 f44276391..8477a756b 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 @@ -41,66 +41,398 @@ fn grid_max_content_single_item_margin_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node1, 28f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node1, 48f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node1, 2f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_max_content_single_item_margin_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node1, 28f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node1, 32f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node1, 48f32, location.x); - assert_eq!(location.y, 2f32, "y of node {:?}. Expected {}. Actual {}", node1, 2f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 2f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c116506da..4b1c771c7 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 @@ -39,66 +39,398 @@ fn grid_max_content_single_item_span_2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node7, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -160,64 +492,396 @@ fn grid_max_content_single_item_span_2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node7, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4d27357b3..c71e224d0 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 @@ -40,66 +40,398 @@ fn grid_max_content_single_item_span_2_gap_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_max_content_single_item_span_2_gap_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 dc495d3d0..8fc8e8f8b 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 @@ -41,66 +41,398 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -164,64 +496,396 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7f59bc87a..5536d0a2c 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 @@ -40,66 +40,398 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -162,64 +494,396 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node3, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node4, 100f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node6, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node6, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node7, 100f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node8, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node8, 0f32, location.x); - assert_eq!(location.y, 120f32, "y of node {:?}. Expected {}. Actual {}", node8, 120f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 120f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d77084e0c..073cb7814 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 @@ -41,30 +41,176 @@ fn grid_max_width_greater_than_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node00, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node01, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +258,174 @@ fn grid_max_width_greater_than_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node00, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node01, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node01, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0b749b8da..b273d5620 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 @@ -41,30 +41,176 @@ fn grid_max_width_less_than_max_content_with_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +258,174 @@ fn grid_max_width_less_than_max_content_with_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e30c449c2..61a674e2a 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 @@ -41,30 +41,176 @@ fn grid_max_width_smaller_than_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +258,174 @@ fn grid_max_width_smaller_than_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e024c4548..6a0d0319d 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 @@ -41,30 +41,176 @@ fn grid_max_width_smaller_than_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -112,28 +258,174 @@ fn grid_max_width_smaller_than_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node00, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node01, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node01, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_min_content_flex_column.rs b/tests/generated/grid/grid_min_content_flex_column.rs index c1d81e5b4..4cc2ed638 100644 --- a/tests/generated/grid/grid_min_content_flex_column.rs +++ b/tests/generated/grid/grid_min_content_flex_column.rs @@ -47,36 +47,221 @@ fn grid_min_content_flex_column__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -130,34 +315,219 @@ fn grid_min_content_flex_column__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 20f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node01, 0f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node01, 20f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node02, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node02, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_min_content_flex_row.rs b/tests/generated/grid/grid_min_content_flex_row.rs index de94a737c..267e658d6 100644 --- a/tests/generated/grid/grid_min_content_flex_row.rs +++ b/tests/generated/grid/grid_min_content_flex_row.rs @@ -43,36 +43,221 @@ fn grid_min_content_flex_row__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node02, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -125,34 +310,219 @@ fn grid_min_content_flex_row__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node01, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node02, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node02, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node02, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 9931da498..cb7a39397 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item.rs @@ -43,60 +43,359 @@ fn grid_min_content_flex_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -159,58 +458,357 @@ fn grid_min_content_flex_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 91466cecf..ed7477208 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 @@ -55,60 +55,359 @@ fn grid_min_content_flex_single_item_margin_auto__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node4, 55f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,58 +482,357 @@ fn grid_min_content_flex_single_item_margin_auto__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 20f32, "y of node {:?}. Expected {}. Actual {}", node1, 20f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 20f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node4, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 55f32, "y of node {:?}. Expected {}. Actual {}", node4, 55f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 55f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 55f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 94b8f70df..4b49612fa 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 @@ -55,60 +55,359 @@ fn grid_min_content_flex_single_item_margin_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node4, 45f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,58 +482,357 @@ fn grid_min_content_flex_single_item_margin_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node1, 5f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node4, 20f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node4, 60f32, location.x); - assert_eq!(location.y, 45f32, "y of node {:?}. Expected {}. Actual {}", node4, 45f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 45f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node7, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 7ca175aef..c7640452f 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 @@ -55,60 +55,359 @@ fn grid_min_content_flex_single_item_margin_percent__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 38f32, "height of node {:?}. Expected {}. Actual {}", node1, 38f32, size.height); - assert_eq!(location.x, 42f32, "x of node {:?}. Expected {}. Actual {}", node1, 42f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node1, 1f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 38f32, layout.size.height); + } + if layout.location.x != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 42f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node4, 28f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node4, 32f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node4, 48f32, location.x); - assert_eq!(location.y, 42f32, "y of node {:?}. Expected {}. Actual {}", node4, 42f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 42f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -183,58 +482,357 @@ fn grid_min_content_flex_single_item_margin_percent__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 38f32, "height of node {:?}. Expected {}. Actual {}", node1, 38f32, size.height); - assert_eq!(location.x, 42f32, "x of node {:?}. Expected {}. Actual {}", node1, 42f32, location.x); - assert_eq!(location.y, 1f32, "y of node {:?}. Expected {}. Actual {}", node1, 1f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 38f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 38f32, layout.size.height); + } + if layout.location.x != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 42f32, layout.location.x); + } + if layout.location.y != 1f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 1f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node2, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node2, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 28f32, "width of node {:?}. Expected {}. Actual {}", node4, 28f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node4, 32f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node4, 48f32, location.x); - assert_eq!(location.y, 42f32, "y of node {:?}. Expected {}. Actual {}", node4, 42f32, location.y); + if layout.size.width != 28f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 28f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 42f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node6, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node7, 50f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2d6289a7d..af1690d36 100644 --- a/tests/generated/grid/grid_min_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_min_content_maximum_single_item.rs @@ -33,66 +33,398 @@ fn grid_min_content_maximum_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_min_content_maximum_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_min_content_single_item.rs b/tests/generated/grid/grid_min_content_single_item.rs index fce8b683e..3dfcec598 100644 --- a/tests/generated/grid/grid_min_content_single_item.rs +++ b/tests/generated/grid/grid_min_content_single_item.rs @@ -33,66 +33,398 @@ fn grid_min_content_single_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_min_content_single_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs index 15355aa61..08b626ca1 100644 --- a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs @@ -25,18 +25,86 @@ fn grid_minmax_auto_fixed_10px__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_auto_fixed_10px__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node0, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_auto_max_content.rs b/tests/generated/grid/grid_minmax_auto_max_content.rs index 0154dfe17..89684b4f6 100644 --- a/tests/generated/grid/grid_minmax_auto_max_content.rs +++ b/tests/generated/grid/grid_minmax_auto_max_content.rs @@ -25,18 +25,86 @@ fn grid_minmax_auto_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_auto_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_auto_min_content.rs b/tests/generated/grid/grid_minmax_auto_min_content.rs index 88e3e819f..ce61654cb 100644 --- a/tests/generated/grid/grid_minmax_auto_min_content.rs +++ b/tests/generated/grid/grid_minmax_auto_min_content.rs @@ -25,18 +25,86 @@ fn grid_minmax_auto_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_auto_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_auto_percent_definite.rs b/tests/generated/grid/grid_minmax_auto_percent_definite.rs index ba60af09c..07c511e45 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_definite.rs @@ -26,18 +26,86 @@ fn grid_minmax_auto_percent_definite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_minmax_auto_percent_definite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs index a4bed242b..da8fefb1b 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs @@ -25,18 +25,86 @@ fn grid_minmax_auto_percent_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 8f32, "width of node {:?}. Expected {}. Actual {}", node0, 8f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 8f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 12f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 12f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_auto_percent_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 8f32, "width of node {:?}. Expected {}. Actual {}", node0, 8f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 8f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 12f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 12f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 39b278a97..607af4fac 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 @@ -29,66 +29,398 @@ fn grid_minmax_column_fixed_width_above_range__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,64 +473,396 @@ fn grid_minmax_column_fixed_width_above_range__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ba4167986..a373c305d 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 @@ -29,66 +29,398 @@ fn grid_minmax_column_fixed_width_below_range__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,64 +473,396 @@ fn grid_minmax_column_fixed_width_below_range__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 90f32, "width of node {:?}. Expected {}. Actual {}", node, 90f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 90f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 90f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 10f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node2, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node4, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node5, 60f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node7, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node8, 60f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c7fb0e674..6a312805e 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 @@ -29,66 +29,398 @@ fn grid_minmax_column_fixed_width_within_range__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node5, 70f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node8, 70f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -141,64 +473,396 @@ fn grid_minmax_column_fixed_width_within_range__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 110f32, "width of node {:?}. Expected {}. Actual {}", node, 110f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 110f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 110f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node2, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node5, 70f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node7, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node8, 70f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_column_indefinite.rs b/tests/generated/grid/grid_minmax_column_indefinite.rs index 0191460a7..c36bc6683 100644 --- a/tests/generated/grid/grid_minmax_column_indefinite.rs +++ b/tests/generated/grid/grid_minmax_column_indefinite.rs @@ -28,66 +28,398 @@ fn grid_minmax_column_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -139,64 +471,396 @@ fn grid_minmax_column_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 08b83fed2..22f6bb8de 100644 --- a/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs @@ -22,24 +22,125 @@ fn grid_minmax_column_with_auto_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,22 +172,123 @@ fn grid_minmax_column_with_auto_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 325f63bbf..f5d8d1308 100644 --- a/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs @@ -22,24 +22,125 @@ fn grid_minmax_column_with_fr_fixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,22 +172,123 @@ fn grid_minmax_column_with_fr_fixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_max_content_1fr.rs b/tests/generated/grid/grid_minmax_max_content_1fr.rs index 0e4b02af8..a03a3602c 100644 --- a/tests/generated/grid/grid_minmax_max_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_max_content_1fr.rs @@ -25,18 +25,86 @@ fn grid_minmax_max_content_1fr__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_max_content_1fr__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_max_content_auto.rs b/tests/generated/grid/grid_minmax_max_content_auto.rs index 2cc3b4c31..329447793 100644 --- a/tests/generated/grid/grid_minmax_max_content_auto.rs +++ b/tests/generated/grid/grid_minmax_max_content_auto.rs @@ -25,18 +25,86 @@ fn grid_minmax_max_content_auto__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_max_content_auto__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 39dd901f5..cb38c94c8 100644 --- a/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs @@ -25,18 +25,86 @@ fn grid_minmax_max_content_fixed_10px__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_max_content_fixed_10px__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c96ffc88c..f965b7856 100644 --- a/tests/generated/grid/grid_minmax_max_content_min_content.rs +++ b/tests/generated/grid/grid_minmax_max_content_min_content.rs @@ -25,18 +25,86 @@ fn grid_minmax_max_content_min_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_max_content_min_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4e9d7d0d0..4d52b6142 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_definite.rs @@ -26,18 +26,86 @@ fn grid_minmax_max_content_percent_definite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_minmax_max_content_percent_definite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2258bb277..bba5abd25 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs @@ -25,18 +25,86 @@ fn grid_minmax_max_content_percent_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_max_content_percent_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_min_content_1fr.rs b/tests/generated/grid/grid_minmax_min_content_1fr.rs index e97cf73b0..3554c70f5 100644 --- a/tests/generated/grid/grid_minmax_min_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_min_content_1fr.rs @@ -25,18 +25,86 @@ fn grid_minmax_min_content_1fr__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_min_content_1fr__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_minmax_min_content_auto.rs b/tests/generated/grid/grid_minmax_min_content_auto.rs index db7d772de..21d5e36fd 100644 --- a/tests/generated/grid/grid_minmax_min_content_auto.rs +++ b/tests/generated/grid/grid_minmax_min_content_auto.rs @@ -25,18 +25,86 @@ fn grid_minmax_min_content_auto__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_min_content_auto__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8162c00bf..2e2f605d6 100644 --- a/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs @@ -25,18 +25,86 @@ fn grid_minmax_min_content_fixed_10px__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_min_content_fixed_10px__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d3b77b7c4..83f3827db 100644 --- a/tests/generated/grid/grid_minmax_min_content_max_content.rs +++ b/tests/generated/grid/grid_minmax_min_content_max_content.rs @@ -25,18 +25,86 @@ fn grid_minmax_min_content_max_content__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_min_content_max_content__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 06e02c573..b6c805d7a 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_definite.rs @@ -26,18 +26,86 @@ fn grid_minmax_min_content_percent_definite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,16 +137,84 @@ fn grid_minmax_min_content_percent_definite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5b1add8a5..efe523513 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs @@ -25,18 +25,86 @@ fn grid_minmax_min_content_percent_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,16 +135,84 @@ fn grid_minmax_min_content_percent_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_out_of_order_items.rs b/tests/generated/grid/grid_out_of_order_items.rs index 9511a1c4c..c8e25a3b7 100644 --- a/tests/generated/grid/grid_out_of_order_items.rs +++ b/tests/generated/grid/grid_out_of_order_items.rs @@ -61,66 +61,398 @@ fn grid_out_of_order_items__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node2, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node2, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node7, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node7, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -202,64 +534,396 @@ fn grid_out_of_order_items__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node0, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node2, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node2, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node2, 80f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node3, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node4, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node5, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node6, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node7, 10f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node7, 10f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node7, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs index 2002b9143..5744260fd 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs @@ -34,36 +34,86 @@ fn grid_overflow_inline_axis_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,34 +154,84 @@ fn grid_overflow_inline_axis_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 50f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 50f32, - layout.scroll_width() - ); + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs index d7f764775..0c3b457b2 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs @@ -34,36 +34,86 @@ fn grid_overflow_inline_axis_scroll__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -104,34 +154,84 @@ fn grid_overflow_inline_axis_scroll__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 65f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 65f32, - layout.scroll_width() - ); + if layout.scroll_width() != 65f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 65f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_inline_axis_visible.rs b/tests/generated/grid/grid_overflow_inline_axis_visible.rs index 06950762c..1b3920b96 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_visible.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_visible.rs @@ -27,18 +27,86 @@ fn grid_overflow_inline_axis_visible__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,16 +139,84 @@ fn grid_overflow_inline_axis_visible__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 50f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 50f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_rows.rs b/tests/generated/grid/grid_overflow_rows.rs index 981e7b095..b2ea68b4c 100644 --- a/tests/generated/grid/grid_overflow_rows.rs +++ b/tests/generated/grid/grid_overflow_rows.rs @@ -36,48 +36,281 @@ fn grid_overflow_rows__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 43f32, "width of node {:?}. Expected {}. Actual {}", node1, 43f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 43f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 203f32, "width of node {:?}. Expected {}. Actual {}", node2, 203f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 43f32, "x of node {:?}. Expected {}. Actual {}", node2, 43f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 203f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 203f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 43f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 246f32, "x of node {:?}. Expected {}. Actual {}", node3, 246f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 246f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 246f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 64f32, "width of node {:?}. Expected {}. Actual {}", node4, 64f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 256f32, "x of node {:?}. Expected {}. Actual {}", node4, 256f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 64f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 256f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 43f32, "width of node {:?}. Expected {}. Actual {}", node5, 43f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 43f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -130,46 +363,279 @@ fn grid_overflow_rows__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node0, 320f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 43f32, "width of node {:?}. Expected {}. Actual {}", node1, 43f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 43f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 203f32, "width of node {:?}. Expected {}. Actual {}", node2, 203f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 43f32, "x of node {:?}. Expected {}. Actual {}", node2, 43f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 203f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 203f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 43f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 246f32, "x of node {:?}. Expected {}. Actual {}", node3, 246f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 246f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 246f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 64f32, "width of node {:?}. Expected {}. Actual {}", node4, 64f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 256f32, "x of node {:?}. Expected {}. Actual {}", node4, 256f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 64f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 256f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 256f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 43f32, "width of node {:?}. Expected {}. Actual {}", node5, 43f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node5, 80f32, location.y); + if layout.size.width != 43f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 43f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs index a3b4db940..5f9dd1c06 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs @@ -36,42 +36,125 @@ fn grid_overflow_scrollbars_overridden_by_available_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,40 +199,123 @@ fn grid_overflow_scrollbars_overridden_by_available_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node00, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs index e38d0b75f..360fcf2dd 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs @@ -27,36 +27,86 @@ fn grid_overflow_scrollbars_overridden_by_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,34 +141,84 @@ fn grid_overflow_scrollbars_overridden_by_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs index 7996ec062..bfd28fb7b 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs @@ -27,36 +27,86 @@ fn grid_overflow_scrollbars_overridden_by_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,34 +141,84 @@ fn grid_overflow_scrollbars_overridden_by_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 efc16bdd2..55875c2cc 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 @@ -27,36 +27,86 @@ fn grid_overflow_scrollbars_take_up_space_both_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,34 +141,84 @@ fn grid_overflow_scrollbars_take_up_space_both_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 17f6b266a..786e882db 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 @@ -27,36 +27,86 @@ fn grid_overflow_scrollbars_take_up_space_x_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,34 +141,84 @@ fn grid_overflow_scrollbars_take_up_space_x_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node0, 50f32, size.width); - assert_eq!(size.height, 35f32, "height of node {:?}. Expected {}. Actual {}", node0, 35f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 35f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6f2f45acd..e4638daf4 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 @@ -27,36 +27,86 @@ fn grid_overflow_scrollbars_take_up_space_y_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,34 +141,84 @@ fn grid_overflow_scrollbars_take_up_space_y_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node0, 35f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 ab998321b..e66ffd1b9 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 @@ -34,18 +34,86 @@ fn grid_padding_border_overrides_container_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,16 +155,84 @@ fn grid_padding_border_overrides_container_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 76ae19fa3..25e367a37 100644 --- a/tests/generated/grid/grid_padding_border_overrides_container_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_container_size.rs @@ -34,18 +34,86 @@ fn grid_padding_border_overrides_container_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -87,16 +155,84 @@ fn grid_padding_border_overrides_container_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node0, 12f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 15f32, "x of node {:?}. Expected {}. Actual {}", node0, 15f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node0, 3f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 15f32, layout.location.x); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 3f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4b598475c..c55ac4943 100644 --- a/tests/generated/grid/grid_padding_border_overrides_max_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_max_size.rs @@ -32,18 +32,86 @@ fn grid_padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn grid_padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 df3768e82..193035d05 100644 --- a/tests/generated/grid/grid_padding_border_overrides_min_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_min_size.rs @@ -32,18 +32,86 @@ fn grid_padding_border_overrides_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn grid_padding_border_overrides_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_padding_border_overrides_size.rs b/tests/generated/grid/grid_padding_border_overrides_size.rs index 90c8c4352..168ea1666 100644 --- a/tests/generated/grid/grid_padding_border_overrides_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_size.rs @@ -32,18 +32,86 @@ fn grid_padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node0, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node0, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -88,16 +156,84 @@ fn grid_padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node0, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node0, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 22722692f..0c5bea151 100644 --- a/tests/generated/grid/grid_percent_item_inside_stretch_item.rs +++ b/tests/generated/grid/grid_percent_item_inside_stretch_item.rs @@ -34,24 +34,137 @@ fn grid_percent_item_inside_stretch_item__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -96,22 +209,135 @@ fn grid_percent_item_inside_stretch_item__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node00, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2f978314f..3de56ae7b 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 @@ -31,24 +31,131 @@ fn grid_percent_items_nested_inside_stretch_alignment__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -90,22 +197,129 @@ fn grid_percent_items_nested_inside_stretch_alignment__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node0, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node00, 200f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node00, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_percent_items_nested_moderate.rs b/tests/generated/grid/grid_percent_items_nested_moderate.rs index af6820594..16fb34ecd 100644 --- a/tests/generated/grid/grid_percent_items_nested_moderate.rs +++ b/tests/generated/grid/grid_percent_items_nested_moderate.rs @@ -65,54 +65,155 @@ fn grid_percent_items_nested_moderate__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 200f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert!( - (size.height - 42.15625f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node, - 42.15625f32, - size.height - ); - assert!((location.x - 0f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert!((location.y - 0f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if (layout.size.width - 200f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if (layout.size.height - 42.15625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(size.height), + 42.15625f32, + layout.size.height + ); + } + if (layout.location.x - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if (layout.location.y - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 97f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node0, 97f32, size.width); - assert!( - (size.height - 26.15625f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node0, - 26.15625f32, - size.height - ); - assert!((location.x - 8f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert!((location.y - 8f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if (layout.size.width - 97f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 97f32, layout.size.width); + } + if (layout.size.height - 26.15625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 26.15625f32, + layout.size.height + ); + } + if (layout.location.x - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if (layout.location.y - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert!( - (size.width - 38.40625f32).abs() < 0.1, - "width of node {:?}. Expected {}. Actual {}", - node00, - 38.40625f32, - size.width - ); - assert!((size.height - 6f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node00, 6f32, size.height); - assert!( - (location.x - 10.078125f32).abs() < 0.1, - "x of node {:?}. Expected {}. Actual {}", - node00, - 10.078125f32, - location.x - ); - assert!( - (location.y - 10.078125f32).abs() < 0.1, - "y of node {:?}. Expected {}. Actual {}", - node00, - 10.078125f32, - location.y - ); + if (layout.size.width - 38.40625f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.width), + 38.40625f32, + layout.size.width + ); + } + if (layout.size.height - 6f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 6f32, layout.size.height); + } + if (layout.location.x - 10.078125f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(location.x), + 10.078125f32, + layout.location.x + ); + } + if (layout.location.y - 10.078125f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(location.y), + 10.078125f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -185,28 +286,123 @@ fn grid_percent_items_nested_moderate__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 206f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node, 206f32, size.width); - assert!((size.height - 44f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node, 44f32, size.height); - assert!((location.x - 0f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert!((location.y - 0f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if (layout.size.width - 206f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 206f32, layout.size.width); + } + if (layout.size.height - 44f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 44f32, layout.size.height); + } + if (layout.location.x - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if (layout.location.y - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 112f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node0, 112f32, size.width); - assert!( - (size.height - 28f32).abs() < 0.1, - "height of node {:?}. Expected {}. Actual {}", - node0, - 28f32, - size.height - ); - assert!((location.x - 8f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node0, 8f32, location.x); - assert!((location.y - 8f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node0, 8f32, location.y); + if (layout.size.width - 112f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 112f32, layout.size.width); + } + if (layout.size.height - 28f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 28f32, layout.size.height); + } + if (layout.location.x - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 8f32, layout.location.x); + } + if (layout.location.y - 8f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert!((size.width - 51f32).abs() < 0.1, "width of node {:?}. Expected {}. Actual {}", node00, 51f32, size.width); - assert!((size.height - 6f32).abs() < 0.1, "height of node {:?}. Expected {}. Actual {}", node00, 6f32, size.height); - assert!((location.x - 11f32).abs() < 0.1, "x of node {:?}. Expected {}. Actual {}", node00, 11f32, location.x); - assert!((location.y - 11f32).abs() < 0.1, "y of node {:?}. Expected {}. Actual {}", node00, 11f32, location.y); + if (layout.size.width - 51f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 51f32, layout.size.width); + } + if (layout.size.height - 6f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 6f32, layout.size.height); + } + if (layout.location.x - 11f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 11f32, layout.location.x); + } + if (layout.location.y - 11f32).abs() >= 0.1 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 11f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if (layout.scroll_width() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if (layout.scroll_height() - 0f32).abs() >= 0.1 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d4a54da7c..ea9188667 100644 --- a/tests/generated/grid/grid_percent_items_nested_with_margin.rs +++ b/tests/generated/grid/grid_percent_items_nested_with_margin.rs @@ -40,24 +40,125 @@ fn grid_percent_items_nested_with_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node00, 45f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -105,22 +206,123 @@ fn grid_percent_items_nested_with_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node00, 45f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node00, 0f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node00, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node00, 5f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 94701c10a..76289ec17 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 @@ -88,36 +88,221 @@ fn grid_percent_items_nested_with_padding_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node0, 190f32, size.width); - assert_eq!(size.height, 41f32, "height of node {:?}. Expected {}. Actual {}", node0, 41f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 41f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 41f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 92f32, "width of node {:?}. Expected {}. Actual {}", node00, 92f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node00, 25f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node00, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node00, 8f32, location.y); + if layout.size.width != 92f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 92f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 25f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node000, 36f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node000, 6f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node000, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node000, 10f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 6f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 149f32, "height of node {:?}. Expected {}. Actual {}", node1, 149f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 51f32, "y of node {:?}. Expected {}. Actual {}", node1, 51f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 149f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 149f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 51f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -216,34 +401,219 @@ fn grid_percent_items_nested_with_padding_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 190f32, "width of node {:?}. Expected {}. Actual {}", node0, 190f32, size.width); - assert_eq!(size.height, 42f32, "height of node {:?}. Expected {}. Actual {}", node0, 42f32, size.height); - assert_eq!(location.x, 5f32, "x of node {:?}. Expected {}. Actual {}", node0, 5f32, location.x); - assert_eq!(location.y, 5f32, "y of node {:?}. Expected {}. Actual {}", node0, 5f32, location.y); + if layout.size.width != 190f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 190f32, layout.size.width); + } + if layout.size.height != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 42f32, layout.size.height); + } + if layout.location.x != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 5f32, layout.location.x); + } + if layout.location.y != 5f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 5f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 103f32, "width of node {:?}. Expected {}. Actual {}", node00, 103f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node00, 26f32, size.height); - assert_eq!(location.x, 8f32, "x of node {:?}. Expected {}. Actual {}", node00, 8f32, location.x); - assert_eq!(location.y, 8f32, "y of node {:?}. Expected {}. Actual {}", node00, 8f32, location.y); + if layout.size.width != 103f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 103f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 26f32, + layout.size.height + ); + } + if layout.location.x != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 8f32, layout.location.x); + } + if layout.location.y != 8f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 8f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node000, 48f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node000, 6f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node000, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node000, 10f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 6f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node1, 200f32, size.width); - assert_eq!(size.height, 148f32, "height of node {:?}. Expected {}. Actual {}", node1, 148f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 52f32, "y of node {:?}. Expected {}. Actual {}", node1, 52f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 148f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(size.height), + 148f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 52f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 fa891a972..8f59e9d6a 100644 --- a/tests/generated/grid/grid_percent_items_width_and_margin.rs +++ b/tests/generated/grid/grid_percent_items_width_and_margin.rs @@ -42,18 +42,86 @@ fn grid_percent_items_width_and_margin__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 31f32, "height of node {:?}. Expected {}. Actual {}", node, 31f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 31f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 31f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 87f32, "width of node {:?}. Expected {}. Actual {}", node0, 87f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node0, 6f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node0, 13f32, location.y); + if layout.size.width != 87f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 87f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 6f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -102,16 +170,84 @@ fn grid_percent_items_width_and_margin__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 206f32, "width of node {:?}. Expected {}. Actual {}", node, 206f32, size.width); - assert_eq!(size.height, 32f32, "height of node {:?}. Expected {}. Actual {}", node, 32f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 206f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 206f32, layout.size.width); + } + if layout.size.height != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 32f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 96f32, "width of node {:?}. Expected {}. Actual {}", node0, 96f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node0, 6f32, size.height); - assert_eq!(location.x, 13f32, "x of node {:?}. Expected {}. Actual {}", node0, 13f32, location.x); - assert_eq!(location.y, 13f32, "y of node {:?}. Expected {}. Actual {}", node0, 13f32, location.y); + if layout.size.width != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 96f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 6f32, layout.size.height); + } + if layout.location.x != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 13f32, layout.location.x); + } + if layout.location.y != 13f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 13f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 92b38cae3..cd0eb5349 100644 --- a/tests/generated/grid/grid_percent_items_width_and_padding.rs +++ b/tests/generated/grid/grid_percent_items_width_and_padding.rs @@ -30,18 +30,86 @@ fn grid_percent_items_width_and_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -78,16 +146,84 @@ fn grid_percent_items_width_and_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 112f32, "width of node {:?}. Expected {}. Actual {}", node0, 112f32, size.width); - assert_eq!(size.height, 12f32, "height of node {:?}. Expected {}. Actual {}", node0, 12f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 112f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 112f32, layout.size.width); + } + if layout.size.height != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 12f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs index 19b6ace1f..eab499eda 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs @@ -29,48 +29,281 @@ fn grid_percent_tracks_definite_overflow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 24f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 18f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 18f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node0, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node1, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node1, 48f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node2, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node2, 96f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node3, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node3, 48f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node4, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node4, 48f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node4, 48f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node4, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node5, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node5, 48f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node5, 96f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,46 +350,279 @@ fn grid_percent_tracks_definite_overflow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 24f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 24f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 18f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 18f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node0, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node0, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node1, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node1, 48f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node2, 48f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node2, 96f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node3, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node3, 48f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node3, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node4, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node4, 48f32, size.height); - assert_eq!(location.x, 48f32, "x of node {:?}. Expected {}. Actual {}", node4, 48f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node4, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 48f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 48f32, "width of node {:?}. Expected {}. Actual {}", node5, 48f32, size.width); - assert_eq!(size.height, 48f32, "height of node {:?}. Expected {}. Actual {}", node5, 48f32, size.height); - assert_eq!(location.x, 96f32, "x of node {:?}. Expected {}. Actual {}", node5, 96f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 48f32, layout.size.width); + } + if layout.size.height != 48f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 48f32, layout.size.height); + } + if layout.location.x != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 96f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs index 3418ead1a..80879f3f0 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs @@ -29,48 +29,281 @@ fn grid_percent_tracks_definite_underflow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node0, 12f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node0, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node1, 24f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node1, 18f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node1, 12f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node2, 36f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node2, 18f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node2, 36f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 36f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node3, 12f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node3, 36f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node3, 18f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node4, 24f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node4, 36f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node4, 12f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node4, 18f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node5, 36f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node5, 36f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node5, 36f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node5, 18f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 36f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -117,46 +350,279 @@ fn grid_percent_tracks_definite_underflow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node0, 12f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node0, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node1, 24f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node1, 18f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node1, 12f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node2, 36f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node2, 18f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node2, 36f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 36f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 12f32, "width of node {:?}. Expected {}. Actual {}", node3, 12f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node3, 36f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node3, 18f32, location.y); + if layout.size.width != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 12f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 24f32, "width of node {:?}. Expected {}. Actual {}", node4, 24f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node4, 36f32, size.height); - assert_eq!(location.x, 12f32, "x of node {:?}. Expected {}. Actual {}", node4, 12f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node4, 18f32, location.y); + if layout.size.width != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 24f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 12f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 12f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 36f32, "width of node {:?}. Expected {}. Actual {}", node5, 36f32, size.width); - assert_eq!(size.height, 36f32, "height of node {:?}. Expected {}. Actual {}", node5, 36f32, size.height); - assert_eq!(location.x, 36f32, "x of node {:?}. Expected {}. Actual {}", node5, 36f32, location.x); - assert_eq!(location.y, 18f32, "y of node {:?}. Expected {}. Actual {}", node5, 18f32, location.y); + if layout.size.width != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 36f32, layout.size.width); + } + if layout.size.height != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 36f32, layout.size.height); + } + if layout.location.x != 36f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 36f32, layout.location.x); + } + if layout.location.y != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 18f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs index f73bee0e7..2483e5441 100644 --- a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs +++ b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs @@ -25,48 +25,281 @@ fn grid_percent_tracks_indefinite_only__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node5, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -109,46 +342,279 @@ fn grid_percent_tracks_indefinite_only__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node0, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node1, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node3, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node4, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node4, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node5, 0f32, size.width); - assert_eq!(size.height, 0f32, "height of node {:?}. Expected {}. Actual {}", node5, 0f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node5, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 0f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 c30dcac72..923b4faa7 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 @@ -42,54 +42,326 @@ fn grid_percent_tracks_indefinite_with_content_overflow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 30f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node4, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node5, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node6, 80f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,52 +421,324 @@ fn grid_percent_tracks_indefinite_with_content_overflow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 20f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 30f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 30f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node1, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node2, 50f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node2, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node3, 50f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node3, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node4, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node4, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node5, 80f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node5, 40f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node5, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node6, 80f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node6, 80f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node6, 50f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 69bc11ce7..e366a1dd2 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 @@ -42,54 +42,326 @@ fn grid_percent_tracks_indefinite_with_content_underflow__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node4, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node4, 30f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node5, 10f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node6, 30f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node6, 60f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node6, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node6, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -149,52 +421,324 @@ fn grid_percent_tracks_indefinite_with_content_underflow__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node2, 30f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node3, 30f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node3, 30f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node3, 30f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node3, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node4, 10f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node4, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node4, 30f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node5, 20f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node5, 60f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node5, 10f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node5, 30f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node6, 30f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node6, 60f32, size.height); - assert_eq!(location.x, 30f32, "x of node {:?}. Expected {}. Actual {}", node6, 30f32, location.x); - assert_eq!(location.y, 30f32, "y of node {:?}. Expected {}. Actual {}", node6, 30f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 30f32, layout.location.x); + } + if layout.location.y != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 30f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_placement_auto_negative.rs b/tests/generated/grid/grid_placement_auto_negative.rs index 2671b06f4..bbdb0f70f 100644 --- a/tests/generated/grid/grid_placement_auto_negative.rs +++ b/tests/generated/grid/grid_placement_auto_negative.rs @@ -37,30 +37,164 @@ fn grid_placement_auto_negative__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -107,28 +241,162 @@ fn grid_placement_auto_negative__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node2, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 24a7acee5..b4d1b378d 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 @@ -42,30 +42,164 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__borde println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -116,28 +250,162 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__conte println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node0, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node0, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_placement_definite_primary.rs b/tests/generated/grid/grid_placement_definite_primary.rs index 0affc1bb0..34e287a46 100644 --- a/tests/generated/grid/grid_placement_definite_primary.rs +++ b/tests/generated/grid/grid_placement_definite_primary.rs @@ -52,42 +52,242 @@ fn grid_placement_definite_primary__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 14f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node0, 66f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node1, 148f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node1, 67f32, size.height); - assert_eq!(location.x, 66f32, "x of node {:?}. Expected {}. Actual {}", node1, 66f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 66f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node2, 66f32, size.width); - assert_eq!(size.height, 66f32, "height of node {:?}. Expected {}. Actual {}", node2, 66f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node2, 67f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 66f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node3, 148f32, size.width); - assert_eq!(size.height, 66f32, "height of node {:?}. Expected {}. Actual {}", node3, 66f32, size.height); - assert_eq!(location.x, 66f32, "x of node {:?}. Expected {}. Actual {}", node3, 66f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node3, 67f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 66f32, layout.size.height); + } + if layout.location.x != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 66f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node4, 66f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node4, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 133f32, "y of node {:?}. Expected {}. Actual {}", node4, 133f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 133f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 133f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -150,40 +350,240 @@ fn grid_placement_definite_primary__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 200f32, "width of node {:?}. Expected {}. Actual {}", node, 200f32, size.width); - assert_eq!(size.height, 200f32, "height of node {:?}. Expected {}. Actual {}", node, 200f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 200f32, layout.size.width); + } + if layout.size.height != 200f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 200f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 14f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 14f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node0, 66f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node0, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node1, 148f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node1, 67f32, size.height); - assert_eq!(location.x, 66f32, "x of node {:?}. Expected {}. Actual {}", node1, 66f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 66f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node2, 66f32, size.width); - assert_eq!(size.height, 66f32, "height of node {:?}. Expected {}. Actual {}", node2, 66f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node2, 67f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 66f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 148f32, "width of node {:?}. Expected {}. Actual {}", node3, 148f32, size.width); - assert_eq!(size.height, 66f32, "height of node {:?}. Expected {}. Actual {}", node3, 66f32, size.height); - assert_eq!(location.x, 66f32, "x of node {:?}. Expected {}. Actual {}", node3, 66f32, location.x); - assert_eq!(location.y, 67f32, "y of node {:?}. Expected {}. Actual {}", node3, 67f32, location.y); + if layout.size.width != 148f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 148f32, layout.size.width); + } + if layout.size.height != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 66f32, layout.size.height); + } + if layout.location.x != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 66f32, layout.location.x); + } + if layout.location.y != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 67f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 66f32, "width of node {:?}. Expected {}. Actual {}", node4, 66f32, size.width); - assert_eq!(size.height, 67f32, "height of node {:?}. Expected {}. Actual {}", node4, 67f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 133f32, "y of node {:?}. Expected {}. Actual {}", node4, 133f32, location.y); + if layout.size.width != 66f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 66f32, layout.size.width); + } + if layout.size.height != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 67f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 133f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 133f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_relative_all_sides.rs b/tests/generated/grid/grid_relative_all_sides.rs index 00ebcff0a..89454e717 100644 --- a/tests/generated/grid/grid_relative_all_sides.rs +++ b/tests/generated/grid/grid_relative_all_sides.rs @@ -33,18 +33,92 @@ fn grid_relative_all_sides__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -84,16 +158,90 @@ fn grid_relative_all_sides__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 100f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 10f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node0, 100f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node0, 10f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node0, 10f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 100f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(size.height), + 100f32, + layout.size.height + ); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_relayout_vertical_text.rs b/tests/generated/grid/grid_relayout_vertical_text.rs index 36c9a71a5..6b2382037 100644 --- a/tests/generated/grid/grid_relayout_vertical_text.rs +++ b/tests/generated/grid/grid_relayout_vertical_text.rs @@ -34,24 +34,125 @@ fn grid_relayout_vertical_text__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +192,123 @@ fn grid_relayout_vertical_text__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 60f32, "height of node {:?}. Expected {}. Actual {}", node, 60f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 60f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_repeat_integer.rs b/tests/generated/grid/grid_repeat_integer.rs index b1650dbe1..a6b063d6c 100644 --- a/tests/generated/grid/grid_repeat_integer.rs +++ b/tests/generated/grid/grid_repeat_integer.rs @@ -32,66 +32,398 @@ fn grid_repeat_integer__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -147,64 +479,396 @@ fn grid_repeat_integer__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_repeat_mixed.rs b/tests/generated/grid/grid_repeat_mixed.rs index 3a72d05d3..6000f5fa1 100644 --- a/tests/generated/grid/grid_repeat_mixed.rs +++ b/tests/generated/grid/grid_repeat_mixed.rs @@ -40,66 +40,398 @@ fn grid_repeat_mixed__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -163,64 +495,396 @@ fn grid_repeat_mixed__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node3, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node4, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node5, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node5, 80f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node6, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node6, 0f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node7, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node7, 40f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node7, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node8, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node8, 80f32, location.x); - assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 80f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_size_child_fixed_tracks.rs b/tests/generated/grid/grid_size_child_fixed_tracks.rs index 5c0fd8ec5..7d6a6c7c5 100644 --- a/tests/generated/grid/grid_size_child_fixed_tracks.rs +++ b/tests/generated/grid/grid_size_child_fixed_tracks.rs @@ -75,42 +75,242 @@ fn grid_size_child_fixed_tracks__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -196,40 +396,240 @@ fn grid_size_child_fixed_tracks__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node, 120f32, size.width); - assert_eq!(size.height, 120f32, "height of node {:?}. Expected {}. Actual {}", node, 120f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 120f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node1, 20f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node2, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node3, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node4, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node4, 40f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 39b571bec..979530990 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 @@ -58,96 +58,617 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node0, 322f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node1, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node2, 91f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 11f32, "x of node {:?}. Expected {}. Actual {}", node2, 11f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 11f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node3, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 102f32, "x of node {:?}. Expected {}. Actual {}", node3, 102f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 102f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 102f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node4, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 113f32, "x of node {:?}. Expected {}. Actual {}", node4, 113f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 113f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 124f32, "x of node {:?}. Expected {}. Actual {}", node5, 124f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 124f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node6, 65f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 134f32, "x of node {:?}. Expected {}. Actual {}", node6, 134f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 134f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 134f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node7, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 199f32, "x of node {:?}. Expected {}. Actual {}", node7, 199f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 199f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 199f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node8, 4f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 201f32, "x of node {:?}. Expected {}. Actual {}", node8, 201f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 201f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 201f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node9, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 205f32, "x of node {:?}. Expected {}. Actual {}", node9, 205f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node9, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 205f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 205f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 207f32, "x of node {:?}. Expected {}. Actual {}", node10, 207f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node10, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 207f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 207f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node11, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 209f32, "x of node {:?}. Expected {}. Actual {}", node11, 209f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 209f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 209f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node12, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node12, 40f32, size.height); - assert_eq!(location.x, 220f32, "x of node {:?}. Expected {}. Actual {}", node12, 220f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 220f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 220f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node13, 91f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node13, 40f32, size.height); - assert_eq!(location.x, 231f32, "x of node {:?}. Expected {}. Actual {}", node13, 231f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node13, 40f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 231f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 231f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -238,94 +759,615 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node0, 322f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node1, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node2, 91f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 11f32, "x of node {:?}. Expected {}. Actual {}", node2, 11f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 11f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node3, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 102f32, "x of node {:?}. Expected {}. Actual {}", node3, 102f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 102f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 102f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node4, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 113f32, "x of node {:?}. Expected {}. Actual {}", node4, 113f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 113f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 113f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 124f32, "x of node {:?}. Expected {}. Actual {}", node5, 124f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 124f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 124f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 65f32, "width of node {:?}. Expected {}. Actual {}", node6, 65f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 134f32, "x of node {:?}. Expected {}. Actual {}", node6, 134f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 65f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 65f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 134f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 134f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node7, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 199f32, "x of node {:?}. Expected {}. Actual {}", node7, 199f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 199f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 199f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node8, 4f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 201f32, "x of node {:?}. Expected {}. Actual {}", node8, 201f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 201f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 201f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node9, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 205f32, "x of node {:?}. Expected {}. Actual {}", node9, 205f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node9, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 205f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 205f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 207f32, "x of node {:?}. Expected {}. Actual {}", node10, 207f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node10, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 207f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 207f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node11, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 209f32, "x of node {:?}. Expected {}. Actual {}", node11, 209f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 209f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 209f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 11f32, "width of node {:?}. Expected {}. Actual {}", node12, 11f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node12, 40f32, size.height); - assert_eq!(location.x, 220f32, "x of node {:?}. Expected {}. Actual {}", node12, 220f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 11f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 11f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 220f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 220f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 91f32, "width of node {:?}. Expected {}. Actual {}", node13, 91f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node13, 40f32, size.height); - assert_eq!(location.x, 231f32, "x of node {:?}. Expected {}. Actual {}", node13, 231f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node13, 40f32, location.y); + if layout.size.width != 91f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 91f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 231f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 231f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 046430049..edb0ade2e 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 @@ -63,114 +63,617 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node0, 322f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node1, 16f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 95f32, "width of node {:?}. Expected {}. Actual {}", node2, 95f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 16f32, "x of node {:?}. Expected {}. Actual {}", node2, 16f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 95f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 16f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node3, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node4, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node5, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 64f32, "width of node {:?}. Expected {}. Actual {}", node6, 64f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 121f32, "x of node {:?}. Expected {}. Actual {}", node6, 121f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 64f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 121f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 121f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node7, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 185f32, "x of node {:?}. Expected {}. Actual {}", node7, 185f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 185f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 185f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node8, 4f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 187f32, "x of node {:?}. Expected {}. Actual {}", node8, 187f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 187f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 187f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node9, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 191f32, "x of node {:?}. Expected {}. Actual {}", node9, 191f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node9, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 191f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 191f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 193f32, "x of node {:?}. Expected {}. Actual {}", node10, 193f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node10, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 193f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 193f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node11, 16f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node11, 195f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node12, 15f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node12, 40f32, size.height); - assert_eq!(location.x, 211f32, "x of node {:?}. Expected {}. Actual {}", node12, 211f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 211f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 211f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 96f32, "width of node {:?}. Expected {}. Actual {}", node13, 96f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node13, 40f32, size.height); - assert_eq!(location.x, 226f32, "x of node {:?}. Expected {}. Actual {}", node13, 226f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node13, 40f32, location.y); + if layout.size.width != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 96f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 226f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 226f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -266,112 +769,615 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node, 322f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 322f32, "width of node {:?}. Expected {}. Actual {}", node0, 322f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 322f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 322f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node1, 16f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 95f32, "width of node {:?}. Expected {}. Actual {}", node2, 95f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 16f32, "x of node {:?}. Expected {}. Actual {}", node2, 16f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 95f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 95f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 16f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node3, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node4, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 111f32, "x of node {:?}. Expected {}. Actual {}", node5, 111f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 111f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 111f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 64f32, "width of node {:?}. Expected {}. Actual {}", node6, 64f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 121f32, "x of node {:?}. Expected {}. Actual {}", node6, 121f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 64f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 64f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 121f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 121f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node7, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 185f32, "x of node {:?}. Expected {}. Actual {}", node7, 185f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 185f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 185f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 4f32, "width of node {:?}. Expected {}. Actual {}", node8, 4f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 187f32, "x of node {:?}. Expected {}. Actual {}", node8, 187f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 4f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 187f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 187f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node9).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node9, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node9, 40f32, size.height); - assert_eq!(location.x, 191f32, "x of node {:?}. Expected {}. Actual {}", node9, 191f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node9, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 191f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.x), 191f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node9, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node9, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node10).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node10, 2f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node10, 40f32, size.height); - assert_eq!(location.x, 193f32, "x of node {:?}. Expected {}. Actual {}", node10, 193f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node10, 40f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 193f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.x), 193f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node10, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node10, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node11).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 16f32, "width of node {:?}. Expected {}. Actual {}", node11, 16f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node11, 40f32, size.height); - assert_eq!(location.x, 195f32, "x of node {:?}. Expected {}. Actual {}", node11, 195f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node11, 40f32, location.y); + if layout.size.width != 16f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(size.width), 16f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 195f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.x), 195f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node11, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node11, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node12).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 15f32, "width of node {:?}. Expected {}. Actual {}", node12, 15f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node12, 40f32, size.height); - assert_eq!(location.x, 211f32, "x of node {:?}. Expected {}. Actual {}", node12, 211f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node12, 40f32, location.y); + if layout.size.width != 15f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(size.width), 15f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 211f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.x), 211f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node12, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node12, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node13).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 96f32, "width of node {:?}. Expected {}. Actual {}", node13, 96f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node13, 40f32, size.height); - assert_eq!(location.x, 226f32, "x of node {:?}. Expected {}. Actual {}", node13, 226f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node13, 40f32, location.y); + if layout.size.width != 96f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(size.width), 96f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(size.height), + 40f32, + layout.size.height + ); + } + if layout.location.x != 226f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.x), 226f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node13, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node13, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 abf6864be..2c886c9de 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 @@ -43,30 +43,164 @@ fn grid_span_2_max_content_auto_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_max_content_auto_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5735bbfe1..4b1f73de5 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 @@ -33,24 +33,125 @@ fn grid_span_2_max_content_auto_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,22 +192,123 @@ fn grid_span_2_max_content_auto_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node0, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b3d04f724..fe69fcc68 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 @@ -43,30 +43,164 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 a73c344fe..3f7ab79b7 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 @@ -48,48 +48,164 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,46 +262,162 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 3af97e9cc..e8f6f98e4 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 @@ -43,30 +43,164 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node0, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 60f32, "x of node {:?}. Expected {}. Actual {}", node1, 60f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 60f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2f09998cf..be2d419e6 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 @@ -48,48 +48,164 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,46 +262,162 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node0, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 80f32, "x of node {:?}. Expected {}. Actual {}", node1, 80f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 80f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8d556f073..69c1fbdb1 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 @@ -43,30 +43,164 @@ fn grid_span_2_max_content_max_content_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_max_content_max_content_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6c84301c2..c13581cb3 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 @@ -30,30 +30,164 @@ fn grid_span_2_min_content_auto_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -94,28 +228,162 @@ fn grid_span_2_min_content_auto_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 21d635772..d49f1b5a8 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 @@ -35,48 +35,164 @@ fn grid_span_2_min_content_auto_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -122,46 +238,162 @@ fn grid_span_2_min_content_auto_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node2, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 6819a11b7..e30c28817 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 @@ -43,30 +43,164 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 4ff1a6635..8b39bc614 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 @@ -48,48 +48,164 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,46 +262,162 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 33bd16408..f19574823 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 @@ -43,30 +43,164 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node2, 50f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 98b1bb049..bfce8002a 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 @@ -48,48 +48,164 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node2, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,46 +262,162 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 30f32, "width of node {:?}. Expected {}. Actual {}", node1, 30f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 30f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node2, 70f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 e6968f1a1..8fcf9b5d7 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 @@ -43,30 +43,164 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 8b2cb386d..a13ccc5e1 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 @@ -48,48 +48,164 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -146,46 +262,162 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 40f32, "x of node {:?}. Expected {}. Actual {}", node1, 40f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 40f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node2, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 5fb8cc8b4..83798c162 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 @@ -43,30 +43,164 @@ fn grid_span_2_min_content_max_content_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_min_content_max_content_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 60f32, "width of node {:?}. Expected {}. Actual {}", node1, 60f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 60f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 60f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 80f32, "width of node {:?}. Expected {}. Actual {}", node2, 80f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 80f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 872f9ff40..30bb18723 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 @@ -43,30 +43,164 @@ fn grid_span_2_min_content_min_content_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -118,28 +252,162 @@ fn grid_span_2_min_content_min_content_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node1, 20f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node2, 40f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node2, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 054da1665..1af2b3da6 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 @@ -41,54 +41,320 @@ fn grid_span_6_all_non_flex_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 89f32, "width of node {:?}. Expected {}. Actual {}", node2, 89f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 89f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 99f32, "x of node {:?}. Expected {}. Actual {}", node3, 99f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 99f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node4, 9f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 109f32, "x of node {:?}. Expected {}. Actual {}", node4, 109f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 109f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 109f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node5, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node6, 128f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,52 +414,318 @@ fn grid_span_6_all_non_flex_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node1, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 89f32, "width of node {:?}. Expected {}. Actual {}", node2, 89f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node2, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 89f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 89f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node3, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 99f32, "x of node {:?}. Expected {}. Actual {}", node3, 99f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 99f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 9f32, "width of node {:?}. Expected {}. Actual {}", node4, 9f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 109f32, "x of node {:?}. Expected {}. Actual {}", node4, 109f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 9f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 9f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 109f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 109f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node5, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node6, 128f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 be9fd0dc6..3cabe85d5 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 @@ -46,72 +46,320 @@ fn grid_span_6_all_non_flex_indefinite_hidden__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 19f32, "width of node {:?}. Expected {}. Actual {}", node1, 19f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 19f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 19f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 99f32, "width of node {:?}. Expected {}. Actual {}", node2, 99f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 19f32, "x of node {:?}. Expected {}. Actual {}", node2, 19f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 99f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 19f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 19f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node3, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node4, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node5, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node6, 128f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -176,70 +424,318 @@ fn grid_span_6_all_non_flex_indefinite_hidden__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); - #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 19f32, "width of node {:?}. Expected {}. Actual {}", node1, 19f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 19f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 19f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 99f32, "width of node {:?}. Expected {}. Actual {}", node2, 99f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 19f32, "x of node {:?}. Expected {}. Actual {}", node2, 19f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 99f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 99f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 19f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 19f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node3, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node4, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 118f32, "x of node {:?}. Expected {}. Actual {}", node5, 118f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 118f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 118f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 128f32, "x of node {:?}. Expected {}. Actual {}", node6, 128f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 128f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 128f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2d74ac717..d34092288 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 @@ -45,66 +45,398 @@ fn grid_span_8_all_track_types_indefinite__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node6, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 39f32, "width of node {:?}. Expected {}. Actual {}", node7, 39f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 42f32, "x of node {:?}. Expected {}. Actual {}", node7, 42f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 39f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 39f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 42f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 79f32, "width of node {:?}. Expected {}. Actual {}", node8, 79f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 81f32, "x of node {:?}. Expected {}. Actual {}", node8, 81f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 79f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 79f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 81f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 81f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -172,64 +504,396 @@ fn grid_span_8_all_track_types_indefinite__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node, 160f32, size.width); - assert_eq!(size.height, 80f32, "height of node {:?}. Expected {}. Actual {}", node, 80f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 80f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 80f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 160f32, "width of node {:?}. Expected {}. Actual {}", node0, 160f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node0, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 160f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 160f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node1, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node1, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node1, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node1, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node2, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node2, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node2, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node3).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node3, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node3, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node3, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node3, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node3, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node4).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 0f32, "width of node {:?}. Expected {}. Actual {}", node4, 0f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node4, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node4, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node4, 40f32, location.y); + if layout.size.width != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.width), 0f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node4, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node4, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node5).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 10f32, "width of node {:?}. Expected {}. Actual {}", node5, 10f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node5, 40f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node5, 0f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node5, 40f32, location.y); + if layout.size.width != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.width), 10f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node5, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node5, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node6).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 32f32, "width of node {:?}. Expected {}. Actual {}", node6, 32f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node6, 40f32, size.height); - assert_eq!(location.x, 10f32, "x of node {:?}. Expected {}. Actual {}", node6, 10f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node6, 40f32, location.y); + if layout.size.width != 32f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.width), 32f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.x), 10f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node6, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node6, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node7).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 39f32, "width of node {:?}. Expected {}. Actual {}", node7, 39f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node7, 40f32, size.height); - assert_eq!(location.x, 42f32, "x of node {:?}. Expected {}. Actual {}", node7, 42f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node7, 40f32, location.y); + if layout.size.width != 39f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.width), 39f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 42f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.x), 42f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node7, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node7, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node8).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 79f32, "width of node {:?}. Expected {}. Actual {}", node8, 79f32, size.width); - assert_eq!(size.height, 40f32, "height of node {:?}. Expected {}. Actual {}", node8, 40f32, size.height); - assert_eq!(location.x, 81f32, "x of node {:?}. Expected {}. Actual {}", node8, 81f32, location.x); - assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node8, 40f32, location.y); + if layout.size.width != 79f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.width), 79f32, layout.size.width); + } + if layout.size.height != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(size.height), 40f32, layout.size.height); + } + if layout.location.x != 81f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.x), 81f32, layout.location.x); + } + if layout.location.y != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node8, stringify!(location.y), 40f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node8, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/grid_taffy_issue_624.rs b/tests/generated/grid/grid_taffy_issue_624.rs index 81b676ae1..fc03dd8d2 100644 --- a/tests/generated/grid/grid_taffy_issue_624.rs +++ b/tests/generated/grid/grid_taffy_issue_624.rs @@ -58,30 +58,164 @@ fn grid_taffy_issue_624__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 640f32, "height of node {:?}. Expected {}. Actual {}", node, 640f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 640f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 640f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node2, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -148,28 +282,162 @@ fn grid_taffy_issue_624__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 320f32, "width of node {:?}. Expected {}. Actual {}", node, 320f32, size.width); - assert_eq!(size.height, 640f32, "height of node {:?}. Expected {}. Actual {}", node, 640f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 320f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 320f32, layout.size.width); + } + if layout.size.height != 640f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 640f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 50f32, "height of node {:?}. Expected {}. Actual {}", node0, 50f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 50f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node1).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node1, 40f32, size.width); - assert_eq!(size.height, 30f32, "height of node {:?}. Expected {}. Actual {}", node1, 30f32, size.height); - assert_eq!(location.x, 100f32, "x of node {:?}. Expected {}. Actual {}", node1, 100f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 30f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(size.height), 30f32, layout.size.height); + } + if layout.location.x != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.x), 100f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node1, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node1, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node2).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 120f32, "width of node {:?}. Expected {}. Actual {}", node2, 120f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node2, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node2, 0f32, location.x); - assert_eq!(location.y, 50f32, "y of node {:?}. Expected {}. Actual {}", node2, 50f32, location.y); + if layout.size.width != 120f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.width), 120f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node2, stringify!(location.y), 50f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node2, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/grid/mod.rs b/tests/generated/grid/mod.rs index f2f16558b..02cc566bb 100644 --- a/tests/generated/grid/mod.rs +++ b/tests/generated/grid/mod.rs @@ -34,6 +34,14 @@ mod grid_absolute_layout_within_border; #[cfg(feature = "grid")] mod grid_absolute_layout_within_border_static; #[cfg(feature = "grid")] +mod grid_absolute_overflow_clip; +#[cfg(feature = "grid")] +mod grid_absolute_overflow_hidden; +#[cfg(feature = "grid")] +mod grid_absolute_overflow_scroll; +#[cfg(feature = "grid")] +mod grid_absolute_overflow_visible; +#[cfg(feature = "grid")] mod grid_absolute_resolved_insets; #[cfg(feature = "grid")] mod grid_absolute_row_end; @@ -236,6 +244,14 @@ mod grid_gap; #[cfg(feature = "grid")] mod grid_hidden; #[cfg(feature = "grid")] +mod grid_inflow_overflow_clip; +#[cfg(feature = "grid")] +mod grid_inflow_overflow_hidden; +#[cfg(feature = "grid")] +mod grid_inflow_overflow_scroll; +#[cfg(feature = "grid")] +mod grid_inflow_overflow_visible; +#[cfg(feature = "grid")] mod grid_justify_content_center; #[cfg(feature = "grid")] mod grid_justify_content_center_negative_space_gap; diff --git a/tests/generated/gridflex/gridflex_column_integration.rs b/tests/generated/gridflex/gridflex_column_integration.rs index 3ff007c4a..fba48435f 100644 --- a/tests/generated/gridflex/gridflex_column_integration.rs +++ b/tests/generated/gridflex/gridflex_column_integration.rs @@ -49,42 +49,266 @@ fn gridflex_column_integration__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -143,40 +367,264 @@ fn gridflex_column_integration__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/gridflex/gridflex_kitchen_sink.rs b/tests/generated/gridflex/gridflex_kitchen_sink.rs index 4fe9a0921..452430c48 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink.rs @@ -75,84 +75,659 @@ fn gridflex_kitchen_sink__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node001, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node001, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node001, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0010, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0010, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0010, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00100, 20f32, size.width); - assert_eq!(size.height, 3f32, "height of node {:?}. Expected {}. Actual {}", node00100, 3f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.height), + 3f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00101, 2f32, size.width); - assert_eq!(size.height, 3f32, "height of node {:?}. Expected {}. Actual {}", node00101, 3f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00101, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00101, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.width), + 2f32, + layout.size.width + ); + } + if layout.size.height != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.height), + 3f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.x), + 20f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00102).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00102, 20f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node00102, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00102, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00102, 3f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(size.height), + 1f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(location.y), + 3f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00103).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00103, 2f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node00103, 1f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00103, 20f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00103, 3f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(size.width), + 2f32, + layout.size.width + ); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(size.height), + 1f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(location.x), + 20f32, + layout.location.x + ); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(location.y), + 3f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node01, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node01, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node02, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node03, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node03, 70f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -253,82 +828,657 @@ fn gridflex_kitchen_sink__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node, 140f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 140f32, "width of node {:?}. Expected {}. Actual {}", node0, 140f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 140f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 140f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node00, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node000).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node000, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node000, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node000, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node000, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node000, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node000, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node001).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node001, 50f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node001, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node001, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node001, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node001, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node001, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0010).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0010, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node0010, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0010, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0010, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0010, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0010, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0010, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00100).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00100, 20f32, size.width); - assert_eq!(size.height, 3f32, "height of node {:?}. Expected {}. Actual {}", node00100, 3f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00100, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(size.height), + 3f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00100, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00101).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00101, 2f32, size.width); - assert_eq!(size.height, 3f32, "height of node {:?}. Expected {}. Actual {}", node00101, 3f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00101, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00101, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.width), + 2f32, + layout.size.width + ); + } + if layout.size.height != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(size.height), + 3f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.x), + 20f32, + layout.location.x + ); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(location.y), + 0f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00101, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00102).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00102, 20f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node00102, 1f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00102, 0f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00102, 3f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(size.width), + 20f32, + layout.size.width + ); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(size.height), + 1f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(location.x), + 0f32, + layout.location.x + ); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(location.y), + 3f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00102, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00103).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node00103, 2f32, size.width); - assert_eq!(size.height, 1f32, "height of node {:?}. Expected {}. Actual {}", node00103, 1f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node00103, 20f32, location.x); - assert_eq!(location.y, 3f32, "y of node {:?}. Expected {}. Actual {}", node00103, 3f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(size.width), + 2f32, + layout.size.width + ); + } + if layout.size.height != 1f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(size.height), + 1f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(location.x), + 20f32, + layout.location.x + ); + } + if layout.location.y != 3f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(location.y), + 3f32, + layout.location.y + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00103, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node01, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node01, 70f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node02, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 70f32, "width of node {:?}. Expected {}. Actual {}", node03, 70f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 70f32, "x of node {:?}. Expected {}. Actual {}", node03, 70f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 70f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 70f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 70f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs index e375ba110..5a4459441 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs @@ -27,30 +27,176 @@ fn gridflex_kitchen_sink_minimise__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -91,28 +237,174 @@ fn gridflex_kitchen_sink_minimise__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node0, 100f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 100f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 100f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node00, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node01, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node01, 20f32, size.height); - assert_eq!(location.x, 50f32, "x of node {:?}. Expected {}. Actual {}", node01, 50f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 50f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs index bb46877c1..cd0178ed0 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs @@ -38,24 +38,131 @@ fn gridflex_kitchen_sink_minimise2__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -101,22 +208,129 @@ fn gridflex_kitchen_sink_minimise2__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs index a3f301242..903443acb 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs @@ -40,42 +40,248 @@ fn gridflex_kitchen_sink_minimise3__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node01, 2f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node01, 6f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 6f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 2f32, "height of node {:?}. Expected {}. Actual {}", node02, 2f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 6f32, "y of node {:?}. Expected {}. Actual {}", node02, 6f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 2f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node03, 2f32, size.width); - assert_eq!(size.height, 2f32, "height of node {:?}. Expected {}. Actual {}", node03, 2f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 6f32, "y of node {:?}. Expected {}. Actual {}", node03, 6f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 2f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -129,40 +335,246 @@ fn gridflex_kitchen_sink_minimise3__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 50f32, "width of node {:?}. Expected {}. Actual {}", node, 50f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 50f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 50f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node0, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 2f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 2f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node00, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 20f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node01, 2f32, size.width); - assert_eq!(size.height, 6f32, "height of node {:?}. Expected {}. Actual {}", node01, 6f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.height), 6f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 2f32, "height of node {:?}. Expected {}. Actual {}", node02, 2f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 6f32, "y of node {:?}. Expected {}. Actual {}", node02, 6f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.height), 2f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node03, 2f32, size.width); - assert_eq!(size.height, 2f32, "height of node {:?}. Expected {}. Actual {}", node03, 2f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 6f32, "y of node {:?}. Expected {}. Actual {}", node03, 6f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.height), 2f32, layout.size.height); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 6f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 6f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/gridflex/gridflex_row_integration.rs b/tests/generated/gridflex/gridflex_row_integration.rs index 910003e57..5c633de13 100644 --- a/tests/generated/gridflex/gridflex_row_integration.rs +++ b/tests/generated/gridflex/gridflex_row_integration.rs @@ -44,42 +44,266 @@ fn gridflex_row_integration__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -134,40 +358,264 @@ fn gridflex_row_integration__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 40f32, "width of node {:?}. Expected {}. Actual {}", node0, 40f32, size.width); - assert_eq!(size.height, 20f32, "height of node {:?}. Expected {}. Actual {}", node0, 20f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 40f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 40f32, layout.size.width); + } + if layout.size.height != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 20f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node00).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node00, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node00, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node00, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node00, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node00, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node00, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node01).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node01, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node01, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node01, 20f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node01, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node01, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node01, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node02).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node02, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node02, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node02, 0f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node02, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node02, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node02, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node03).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node03, 20f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node03, 10f32, size.height); - assert_eq!(location.x, 20f32, "x of node {:?}. Expected {}. Actual {}", node03, 20f32, location.x); - assert_eq!(location.y, 10f32, "y of node {:?}. Expected {}. Actual {}", node03, 10f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(size.height), + 10f32, + layout.size.height + ); + } + if layout.location.x != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.x), 20f32, layout.location.x); + } + if layout.location.y != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node03, stringify!(location.y), 10f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node03, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_overflow_clip.rs b/tests/generated/leaf/leaf_overflow_clip.rs new file mode 100644 index 000000000..3194fb04f --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_clip.rs @@ -0,0 +1,136 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_clip_with_border.rs b/tests/generated/leaf/leaf_overflow_clip_with_border.rs new file mode 100644 index 000000000..2639a26b8 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_clip_with_border.rs @@ -0,0 +1,148 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_border__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 171f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 171f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 29f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 29f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_border__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs new file mode 100644 index 000000000..790b5de77 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs @@ -0,0 +1,162 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_border_and_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 183f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 183f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 33f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 33f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_border_and_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 161f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 161f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 19f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 19f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_clip_with_padding.rs b/tests/generated/leaf/leaf_overflow_clip_with_padding.rs new file mode 100644 index 000000000..8aeb83a8b --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_clip_with_padding.rs @@ -0,0 +1,150 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 169f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 169f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 26f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_clip_with_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 163f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 163f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 22f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_hidden.rs b/tests/generated/leaf/leaf_overflow_hidden.rs new file mode 100644 index 000000000..ae12d0ec5 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_hidden.rs @@ -0,0 +1,142 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_hidden_with_border.rs b/tests/generated/leaf/leaf_overflow_hidden_with_border.rs new file mode 100644 index 000000000..b7e55993c --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_hidden_with_border.rs @@ -0,0 +1,154 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_border__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 171f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 171f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 29f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 29f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_border__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_hidden_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_hidden_with_border_and_padding.rs new file mode 100644 index 000000000..cdff61f6d --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_hidden_with_border_and_padding.rs @@ -0,0 +1,168 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_border_and_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 187f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 187f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 39f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 39f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_border_and_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_hidden_with_padding.rs b/tests/generated/leaf/leaf_overflow_hidden_with_padding.rs new file mode 100644 index 000000000..f13544637 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_hidden_with_padding.rs @@ -0,0 +1,156 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 171f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 171f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 29f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 29f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_hidden_with_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Hidden, + y: taffy::style::Overflow::Hidden, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_scroll.rs b/tests/generated/leaf/leaf_overflow_scroll.rs new file mode 100644 index 000000000..938a9d791 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_scroll.rs @@ -0,0 +1,142 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_scroll_with_border.rs b/tests/generated/leaf/leaf_overflow_scroll_with_border.rs new file mode 100644 index 000000000..e711a6de8 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_scroll_with_border.rs @@ -0,0 +1,154 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_border__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 186f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 186f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_border__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_scroll_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_scroll_with_border_and_padding.rs new file mode 100644 index 000000000..ec2b987a5 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_scroll_with_border_and_padding.rs @@ -0,0 +1,168 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_border_and_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 202f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 202f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 54f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 54f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_border_and_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_scroll_with_padding.rs b/tests/generated/leaf/leaf_overflow_scroll_with_padding.rs new file mode 100644 index 000000000..5f2300a2c --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_scroll_with_padding.rs @@ -0,0 +1,156 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 186f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 186f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 44f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 44f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_scroll_with_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Scroll, + y: taffy::style::Overflow::Scroll, + }, + scrollbar_width: 15f32, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 40f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 40f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} 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 e622efa33..221c793ca 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 @@ -25,30 +25,47 @@ fn leaf_overflow_scrollbars_affect_available_space_x_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 165f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 165f32, - layout.scroll_width() - ); + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,28 +96,45 @@ fn leaf_overflow_scrollbars_affect_available_space_x_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 165f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 165f32, - layout.scroll_width() - ); + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 965360175..b92c6f68f 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 @@ -25,30 +25,47 @@ fn leaf_overflow_scrollbars_affect_available_space_y_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 180f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 180f32, - layout.scroll_width() - ); + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -79,28 +96,45 @@ fn leaf_overflow_scrollbars_affect_available_space_y_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 45f32, "width of node {:?}. Expected {}. Actual {}", node, 45f32, size.width); - assert_eq!(size.height, 45f32, "height of node {:?}. Expected {}. Actual {}", node, 45f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 180f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 180f32, - layout.scroll_width() - ); + if layout.scroll_width() != 180f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 180f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs index 06c9f8dec..ca03b6b7c 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs @@ -28,36 +28,86 @@ fn leaf_overflow_scrollbars_overridden_by_available_space__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -92,34 +142,84 @@ fn leaf_overflow_scrollbars_overridden_by_available_space__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } let layout = taffy.layout(node0).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node0, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node0, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node0, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node0, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node0, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node0, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_max_size.rs index b1abf7d05..b55a32352 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_max_size.rs @@ -19,30 +19,47 @@ fn leaf_overflow_scrollbars_overridden_by_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,28 +84,45 @@ fn leaf_overflow_scrollbars_overridden_by_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_size.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_size.rs index f7d8095d8..f2b9f0d71 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_size.rs @@ -19,30 +19,47 @@ fn leaf_overflow_scrollbars_overridden_by_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,28 +84,45 @@ fn leaf_overflow_scrollbars_overridden_by_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 2f32, "width of node {:?}. Expected {}. Actual {}", node, 2f32, size.width); - assert_eq!(size.height, 4f32, "height of node {:?}. Expected {}. Actual {}", node, 4f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 2f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 2f32, layout.size.width); + } + if layout.size.height != 4f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 4f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 0ddfc513a..8851778f7 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 @@ -21,30 +21,47 @@ fn leaf_overflow_scrollbars_take_up_space_both_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,28 +88,45 @@ fn leaf_overflow_scrollbars_take_up_space_both_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 d82524e71..6f8d0ca88 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 @@ -21,30 +21,47 @@ fn leaf_overflow_scrollbars_take_up_space_x_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,28 +88,45 @@ fn leaf_overflow_scrollbars_take_up_space_x_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 20f32, "width of node {:?}. Expected {}. Actual {}", node, 20f32, size.width); - assert_eq!(size.height, 25f32, "height of node {:?}. Expected {}. Actual {}", node, 25f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 20f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 20f32, layout.size.width); + } + if layout.size.height != 25f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 25f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 2b9902d03..6f56e19d7 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 @@ -21,30 +21,47 @@ fn leaf_overflow_scrollbars_take_up_space_y_axis__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -71,28 +88,45 @@ fn leaf_overflow_scrollbars_take_up_space_y_axis__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 35f32, "width of node {:?}. Expected {}. Actual {}", node, 35f32, size.width); - assert_eq!(size.height, 10f32, "height of node {:?}. Expected {}. Actual {}", node, 10f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 35f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 35f32, layout.size.width); + } + if layout.size.height != 10f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 10f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_width(), - 0f32, - "scroll_width of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_width() - ); + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } #[cfg(feature = "content_size")] - assert_eq!( - layout.scroll_height(), - 0f32, - "scroll_height of node {:?}. Expected {}. Actual {}", - node, - 0f32, - layout.scroll_height() - ); + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_overflow_visible.rs b/tests/generated/leaf/leaf_overflow_visible.rs new file mode 100644 index 000000000..e11d28e29 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_visible.rs @@ -0,0 +1,132 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_visible_with_border.rs b/tests/generated/leaf/leaf_overflow_visible_with_border.rs new file mode 100644 index 000000000..d4b71ec9a --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_visible_with_border.rs @@ -0,0 +1,144 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_border__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 171f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 171f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 29f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 29f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_border__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + border: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 165f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 165f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 25f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 25f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs new file mode 100644 index 000000000..ba845baac --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs @@ -0,0 +1,158 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_border_and_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 183f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 183f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 33f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 33f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_border_and_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(8f32), + right: length(4f32), + top: length(2f32), + bottom: length(6f32), + }, + border: taffy::geometry::Rect { + left: length(7f32), + right: length(3f32), + top: length(1f32), + bottom: length(5f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 67f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 67f32, layout.size.width); + } + if layout.size.height != 59f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 59f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 161f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 161f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 19f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 19f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} diff --git a/tests/generated/leaf/leaf_overflow_visible_with_padding.rs b/tests/generated/leaf/leaf_overflow_visible_with_padding.rs new file mode 100644 index 000000000..638141372 --- /dev/null +++ b/tests/generated/leaf/leaf_overflow_visible_with_padding.rs @@ -0,0 +1,146 @@ +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_padding__border_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 45f32, layout.size.width); + } + if layout.size.height != 45f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 45f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 169f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 169f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 26f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 26f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} + +#[test] +#[allow(non_snake_case)] +fn leaf_overflow_visible_with_padding__content_box() { + #[allow(unused_imports)] + use taffy::{prelude::*, Layout}; + let mut taffy = crate::new_test_tree(); + let node_text = "HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH\u{200b}HHHHHHHHHHHHHHHHHHHHH" ; + let node = taffy + .new_leaf_with_context( + taffy::style::Style { + display: taffy::style::Display::Block, + box_sizing: taffy::style::BoxSizing::ContentBox, + size: taffy::geometry::Size { + width: taffy::style::Dimension::from_length(45f32), + height: taffy::style::Dimension::from_length(45f32), + }, + padding: taffy::geometry::Rect { + left: length(4f32), + right: length(2f32), + top: length(1f32), + bottom: length(3f32), + }, + ..Default::default() + }, + crate::TestNodeContext::ahem_text(node_text, crate::WritingMode::Horizontal), + ) + .unwrap(); + taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); + println!("\nComputed tree:"); + taffy.print_tree(node); + println!(); + let mut mismatches = 0u32; + let layout = taffy.layout(node).unwrap(); + if layout.size.width != 51f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 51f32, layout.size.width); + } + if layout.size.height != 49f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 49f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 163f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 163f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 22f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 22f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); +} 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 4637fd509..2a4c8bd84 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs @@ -29,12 +29,47 @@ fn leaf_padding_border_overrides_max_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,10 +104,45 @@ fn leaf_padding_border_overrides_max_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 b9633ff82..0168fc1d2 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs @@ -29,12 +29,47 @@ fn leaf_padding_border_overrides_min_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,10 +104,45 @@ fn leaf_padding_border_overrides_min_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_padding_border_overrides_size.rs b/tests/generated/leaf/leaf_padding_border_overrides_size.rs index 5d211789e..a74ce39e1 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_size.rs @@ -29,12 +29,47 @@ fn leaf_padding_border_overrides_size__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 22f32, "width of node {:?}. Expected {}. Actual {}", node, 22f32, size.width); - assert_eq!(size.height, 14f32, "height of node {:?}. Expected {}. Actual {}", node, 14f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 22f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 22f32, layout.size.width); + } + if layout.size.height != 14f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 14f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -69,10 +104,45 @@ fn leaf_padding_border_overrides_size__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 34f32, "width of node {:?}. Expected {}. Actual {}", node, 34f32, size.width); - assert_eq!(size.height, 26f32, "height of node {:?}. Expected {}. Actual {}", node, 26f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 34f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 34f32, layout.size.width); + } + if layout.size.height != 26f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 26f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_with_content_and_border.rs b/tests/generated/leaf/leaf_with_content_and_border.rs index bb8504420..c3c317170 100644 --- a/tests/generated/leaf/leaf_with_content_and_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_border.rs @@ -22,12 +22,47 @@ fn leaf_with_content_and_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,10 +90,45 @@ fn leaf_with_content_and_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/leaf_with_content_and_padding.rs b/tests/generated/leaf/leaf_with_content_and_padding.rs index 96365ae73..13958a24f 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding.rs @@ -22,12 +22,47 @@ fn leaf_with_content_and_padding__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -55,10 +90,45 @@ fn leaf_with_content_and_padding__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 52f32, "width of node {:?}. Expected {}. Actual {}", node, 52f32, size.width); - assert_eq!(size.height, 18f32, "height of node {:?}. Expected {}. Actual {}", node, 18f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 52f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 52f32, layout.size.width); + } + if layout.size.height != 18f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 18f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } 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 51019a900..b787dffe0 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding_border.rs @@ -28,12 +28,47 @@ fn leaf_with_content_and_padding_border__border_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } #[test] @@ -67,10 +102,45 @@ fn leaf_with_content_and_padding_border__content_box() { println!("\nComputed tree:"); taffy.print_tree(node); println!(); + let mut mismatches = 0u32; let layout = taffy.layout(node).unwrap(); - let Layout { size, location, .. } = layout; - assert_eq!(size.width, 62f32, "width of node {:?}. Expected {}. Actual {}", node, 62f32, size.width); - assert_eq!(size.height, 24f32, "height of node {:?}. Expected {}. Actual {}", node, 24f32, size.height); - assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x); - assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y); + if layout.size.width != 62f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.width), 62f32, layout.size.width); + } + if layout.size.height != 24f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(size.height), 24f32, layout.size.height); + } + if layout.location.x != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.x), 0f32, layout.location.x); + } + if layout.location.y != 0f32 { + mismatches += 1; + eprintln!("{:?}.{} mismatch: expected {} actual {}", node, stringify!(location.y), 0f32, layout.location.y); + } + #[cfg(feature = "content_size")] + if layout.scroll_width() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_width()), + 0f32, + layout.scroll_width() + ); + } + #[cfg(feature = "content_size")] + if layout.scroll_height() != 0f32 { + mismatches += 1; + eprintln!( + "{:?}.{} mismatch: expected {} actual {}", + node, + stringify!(scroll_height()), + 0f32, + layout.scroll_height() + ); + } + assert!(mismatches == 0, "Detected {mismatches} mismatch(es)"); } diff --git a/tests/generated/leaf/mod.rs b/tests/generated/leaf/mod.rs index 161131924..1b5608a83 100644 --- a/tests/generated/leaf/mod.rs +++ b/tests/generated/leaf/mod.rs @@ -1,3 +1,15 @@ +mod leaf_overflow_clip; +mod leaf_overflow_clip_with_border; +mod leaf_overflow_clip_with_border_and_padding; +mod leaf_overflow_clip_with_padding; +mod leaf_overflow_hidden; +mod leaf_overflow_hidden_with_border; +mod leaf_overflow_hidden_with_border_and_padding; +mod leaf_overflow_hidden_with_padding; +mod leaf_overflow_scroll; +mod leaf_overflow_scroll_with_border; +mod leaf_overflow_scroll_with_border_and_padding; +mod leaf_overflow_scroll_with_padding; mod leaf_overflow_scrollbars_affect_available_space_x_axis; mod leaf_overflow_scrollbars_affect_available_space_y_axis; mod leaf_overflow_scrollbars_overridden_by_available_space; @@ -6,6 +18,10 @@ mod leaf_overflow_scrollbars_overridden_by_size; mod leaf_overflow_scrollbars_take_up_space_both_axis; mod leaf_overflow_scrollbars_take_up_space_x_axis; mod leaf_overflow_scrollbars_take_up_space_y_axis; +mod leaf_overflow_visible; +mod leaf_overflow_visible_with_border; +mod leaf_overflow_visible_with_border_and_padding; +mod leaf_overflow_visible_with_padding; mod leaf_padding_border_overrides_max_size; mod leaf_padding_border_overrides_min_size; mod leaf_padding_border_overrides_size; From 4216099c78314c1834e14b394b24defa56be7d6d Mon Sep 17 00:00:00 2001 From: William Howe-Lott Date: Thu, 16 Oct 2025 11:53:53 -0700 Subject: [PATCH 2/3] gentest: explicitly set overflow instead relying on defaults. --- scripts/gentest/src/main.rs | 30 +- ...ct_ratio_overrides_height_of_full_inset.rs | 10 + ...block_absolute_aspect_ratio_fill_height.rs | 10 + ...ute_aspect_ratio_fill_height_from_inset.rs | 10 + ...k_absolute_aspect_ratio_fill_max_height.rs | 16 + ...ck_absolute_aspect_ratio_fill_max_width.rs | 16 + ...k_absolute_aspect_ratio_fill_min_height.rs | 10 + ...ck_absolute_aspect_ratio_fill_min_width.rs | 10 + .../block_absolute_aspect_ratio_fill_width.rs | 10 + ...lute_aspect_ratio_fill_width_from_inset.rs | 10 + ...ute_aspect_ratio_height_overrides_inset.rs | 10 + ...lute_aspect_ratio_width_overrides_inset.rs | 10 + .../block_absolute_child_with_margin_x.rs | 14 + .../block_absolute_child_with_margin_y.rs | 14 + .../block_absolute_child_with_max_height.rs | 18 + .../block_absolute_layout_child_order.rs | 14 + .../block/block_absolute_layout_no_size.rs | 15 +- ...ercentage_bottom_based_on_parent_height.rs | 14 + ...block_absolute_layout_percentage_height.rs | 10 + ...lute_layout_row_width_height_end_bottom.rs | 10 + ...ck_absolute_layout_start_top_end_bottom.rs | 10 + ...absolute_layout_width_height_end_bottom.rs | 10 + ..._absolute_layout_width_height_start_top.rs | 10 + ...ayout_width_height_start_top_end_bottom.rs | 10 + .../block_absolute_layout_within_border.rs | 16 + ...e_margin_auto_bottom_and_top_with_inset.rs | 10 + ...argin_auto_bottom_and_top_without_inset.rs | 10 + ..._absolute_margin_auto_bottom_with_inset.rs | 10 + ...solute_margin_auto_bottom_without_inset.rs | 10 + ...e_margin_auto_left_and_right_with_inset.rs | 10 + ...argin_auto_left_and_right_without_inset.rs | 10 + ...eft_child_bigger_than_parent_with_inset.rs | 10 + ..._child_bigger_than_parent_without_inset.rs | 10 + ...ght_child_bigger_than_parent_with_inset.rs | 10 + ..._child_bigger_than_parent_without_inset.rs | 10 + ...ght_child_bigger_than_parent_with_inset.rs | 10 + ..._child_bigger_than_parent_without_inset.rs | 10 + ...ck_absolute_margin_auto_left_with_inset.rs | 10 + ...absolute_margin_auto_left_without_inset.rs | 10 + ...argin_auto_multiple_children_with_inset.rs | 12 + ...in_auto_multiple_children_without_inset.rs | 12 + ...k_absolute_margin_auto_right_with_inset.rs | 10 + ...bsolute_margin_auto_right_without_inset.rs | 10 + ...ock_absolute_margin_auto_top_with_inset.rs | 10 + ..._absolute_margin_auto_top_without_inset.rs | 10 + ..._absolute_margin_bottom_left_with_inset.rs | 10 + ...solute_margin_bottom_left_without_inset.rs | 10 + .../block_absolute_minmax_bottom_right_max.rs | 10 + ...ck_absolute_minmax_bottom_right_min_max.rs | 10 + ...e_minmax_bottom_right_min_max_preferred.rs | 10 + ...solute_minmax_top_left_bottom_right_max.rs | 10 + ...te_minmax_top_left_bottom_right_min_max.rs | 10 + .../block/block_absolute_no_styles.rs | 17 +- .../block/block_absolute_overflow_clip.rs | 10 +- .../block/block_absolute_overflow_hidden.rs | 8 + .../block/block_absolute_overflow_scroll.rs | 8 + .../block/block_absolute_overflow_visible.rs | 16 + ...olute_padding_border_overrides_max_size.rs | 15 +- ..._absolute_padding_border_overrides_size.rs | 15 +- .../block/block_absolute_resolved_insets.rs | 66 +++- .../block/block_align_baseline_child.rs | 20 ++ .../block_align_baseline_child_margin.rs | 20 ++ ...ock_align_baseline_child_margin_percent.rs | 20 ++ .../block_align_baseline_child_padding.rs | 20 ++ .../block/block_align_baseline_child_top.rs | 20 ++ .../block/block_align_baseline_child_top2.rs | 20 ++ ...lock_align_baseline_double_nested_child.rs | 28 ++ .../block/block_aspect_ratio_fill_height.rs | 10 + .../block_aspect_ratio_fill_max_height.rs | 16 + .../block_aspect_ratio_fill_max_width.rs | 16 + .../block_aspect_ratio_fill_min_height.rs | 10 + .../block_aspect_ratio_fill_min_width.rs | 16 + .../block/block_aspect_ratio_fill_width.rs | 10 + tests/generated/block/block_basic.rs | 12 + .../block/block_border_fixed_size.rs | 12 + .../block/block_border_intrinsic_size.rs | 12 + .../block_border_percentage_fixed_size.rs | 23 +- .../block_border_percentage_intrinsic_size.rs | 28 +- tests/generated/block/block_display_none.rs | 14 + .../block/block_display_none_with_child.rs | 27 +- .../block/block_display_none_with_inset.rs | 12 + .../block/block_display_none_with_margin.rs | 12 + ...ock_display_none_with_position_absolute.rs | 10 + .../block/block_inflow_overflow_clip.rs | 10 +- .../block/block_inflow_overflow_hidden.rs | 8 + .../block/block_inflow_overflow_scroll.rs | 8 + .../block/block_inflow_overflow_visible.rs | 16 + tests/generated/block/block_inset_fixed.rs | 14 + .../generated/block/block_inset_percentage.rs | 14 + .../generated/block/block_intrinsic_width.rs | 17 +- tests/generated/block/block_item_max_width.rs | 12 + ...lock_item_min_width_overrides_max_width.rs | 10 + .../block/block_item_text_align_center.rs | 12 + .../block/block_item_text_align_left.rs | 12 + .../block/block_item_text_align_right.rs | 12 + .../block/block_margin_auto_bottom.rs | 12 + .../block/block_margin_auto_bottom_and_top.rs | 12 + .../generated/block/block_margin_auto_left.rs | 12 + .../block/block_margin_auto_left_and_right.rs | 12 + ...gin_auto_left_and_right_with_auto_width.rs | 16 + ...rgin_auto_left_child_bigger_than_parent.rs | 10 + ...left_fix_right_child_bigger_than_parent.rs | 10 + ...uto_left_right_child_bigger_than_parent.rs | 10 + .../block_margin_auto_multiple_children.rs | 14 + .../block/block_margin_auto_right.rs | 12 + .../generated/block/block_margin_auto_top.rs | 12 + .../block/block_margin_x_fixed_auto_bottom.rs | 12 + .../block/block_margin_x_fixed_auto_left.rs | 12 + ...lock_margin_x_fixed_auto_left_and_right.rs | 12 + .../block/block_margin_x_fixed_auto_right.rs | 12 + .../block/block_margin_x_fixed_auto_top.rs | 12 + .../block_margin_x_fixed_size_negative.rs | 12 + .../block_margin_x_fixed_size_positive.rs | 12 + .../block_margin_x_intrinsic_size_negative.rs | 17 +- .../block_margin_x_intrinsic_size_positive.rs | 17 +- ...margin_x_percentage_fixed_size_negative.rs | 12 + ...margin_x_percentage_fixed_size_positive.rs | 12 + ...ercentage_intrinsic_size_other_negative.rs | 17 +- ...ercentage_intrinsic_size_other_positive.rs | 17 +- ...percentage_intrinsic_size_self_negative.rs | 15 +- ...percentage_intrinsic_size_self_positive.rs | 15 +- .../block/block_margin_y_collapse_complex.rs | 28 ++ ...ollapse_through_blocked_by_aspect_ratio.rs | 14 + ...llapse_through_blocked_by_border_bottom.rs | 14 + ..._collapse_through_blocked_by_border_top.rs | 14 + ...in_y_collapse_through_blocked_by_height.rs | 14 + ..._y_collapse_through_blocked_by_line_box.rs | 20 ++ ...gh_blocked_by_line_box_with_height_zero.rs | 20 ++ ...locked_by_line_box_with_max_height_zero.rs | 20 ++ ..._collapse_through_blocked_by_min_height.rs | 14 + ...se_through_blocked_by_overflow_x_hidden.rs | 12 + ...se_through_blocked_by_overflow_x_scroll.rs | 12 + ...se_through_blocked_by_overflow_y_hidden.rs | 12 + ...se_through_blocked_by_overflow_y_scroll.rs | 12 + ...lapse_through_blocked_by_padding_bottom.rs | 14 + ...collapse_through_blocked_by_padding_top.rs | 14 + ...lock_margin_y_collapse_through_negative.rs | 14 + ...lock_margin_y_collapse_through_positive.rs | 14 + ..._collapse_through_positive_and_negative.rs | 14 + ..._y_collapse_through_with_absolute_child.rs | 33 +- ...st_child_collapse_blocked_by_border_top.rs | 26 ++ ...d_collapse_blocked_by_overflow_x_hidden.rs | 18 + ...d_collapse_blocked_by_overflow_x_scroll.rs | 18 + ...d_collapse_blocked_by_overflow_y_hidden.rs | 18 + ...d_collapse_blocked_by_overflow_y_scroll.rs | 18 + ...t_child_collapse_blocked_by_padding_top.rs | 26 ++ ...n_y_first_child_collapse_negative_equal.rs | 26 ++ ...t_child_collapse_negative_parent_larger.rs | 26 ++ ..._child_collapse_negative_parent_smaller.rs | 26 ++ ...d_collapse_not_blocked_by_border_bottom.rs | 26 ++ ..._collapse_not_blocked_by_padding_bottom.rs | 26 ++ ...st_child_collapse_positive_and_negative.rs | 62 ++++ ...n_y_first_child_collapse_positive_equal.rs | 26 ++ ...t_child_collapse_positive_parent_larger.rs | 26 ++ ..._child_collapse_positive_parent_smaller.rs | 26 ++ ...ranchild_collapse_positive_and_negative.rs | 86 +++++ ...first_granchild_collapse_positive_equal.rs | 34 ++ ...child_collapse_blocked_by_border_bottom.rs | 26 ++ ...d_collapse_blocked_by_overflow_x_hidden.rs | 18 + ...d_collapse_blocked_by_overflow_x_scroll.rs | 18 + ...d_collapse_blocked_by_overflow_y_hidden.rs | 18 + ...d_collapse_blocked_by_overflow_y_scroll.rs | 18 + ...hild_collapse_blocked_by_padding_bottom.rs | 26 ++ ...in_y_last_child_collapse_negative_equal.rs | 26 ++ ...t_child_collapse_negative_parent_larger.rs | 26 ++ ..._child_collapse_negative_parent_smaller.rs | 26 ++ ...hild_collapse_not_blocked_by_border_top.rs | 26 ++ ...ild_collapse_not_blocked_by_padding_top.rs | 26 ++ ...st_child_collapse_positive_and_negative.rs | 62 ++++ ...in_y_last_child_collapse_positive_equal.rs | 26 ++ ...t_child_collapse_positive_parent_larger.rs | 26 ++ ..._child_collapse_positive_parent_smaller.rs | 26 ++ ..._last_granchild_collapse_positive_equal.rs | 34 ++ ...lock_margin_y_sibling_collapse_negative.rs | 16 + ..._y_sibling_collapse_negative_percentage.rs | 16 + ...lock_margin_y_sibling_collapse_positive.rs | 16 + ..._sibling_collapse_positive_and_negative.rs | 22 ++ ...llapse_positive_and_negative_percentage.rs | 22 ++ ..._y_sibling_collapse_positive_percentage.rs | 16 + .../block/block_margin_y_simple_negative.rs | 12 + ...rgin_y_simple_negative_percentage_other.rs | 12 + ...argin_y_simple_negative_percentage_self.rs | 12 + .../block/block_margin_y_simple_positive.rs | 12 + ...rgin_y_simple_positive_percentage_other.rs | 17 +- ...argin_y_simple_positive_percentage_self.rs | 17 +- .../block/block_margin_y_total_collapse.rs | 22 ++ .../block_margin_y_total_collapse_complex.rs | 28 ++ ...crollbars_overridden_by_available_space.rs | 10 + ...rflow_scrollbars_overridden_by_max_size.rs | 2 + ..._overflow_scrollbars_overridden_by_size.rs | 2 + ...flow_scrollbars_take_up_space_both_axis.rs | 2 + ...low_scrollbars_take_up_space_cross_axis.rs | 2 + ...flow_scrollbars_take_up_space_main_axis.rs | 2 + .../block/block_padding_border_fixed_size.rs | 12 + .../block_padding_border_intrinsic_size.rs | 12 + ...block_padding_border_overrides_max_size.rs | 34 +- ...block_padding_border_overrides_min_size.rs | 34 +- .../block_padding_border_overrides_size.rs | 34 +- ...ck_padding_border_percentage_fixed_size.rs | 18 + ...adding_border_percentage_intrinsic_size.rs | 23 +- .../block/block_padding_fixed_size.rs | 12 + .../block/block_padding_intrinsic_size.rs | 12 + .../block_padding_percentage_fixed_size.rs | 18 + ...block_padding_percentage_intrinsic_size.rs | 23 +- .../blockflex_block_in_flex_column.rs | 20 +- .../blockflex/blockflex_block_in_flex_row.rs | 20 +- .../blockflex/blockflex_flex_in_block.rs | 25 +- ...rgin_y_collapse_through_blocked_by_flex.rs | 14 + ..._y_first_child_collapse_blocked_by_flex.rs | 26 ++ ...n_y_last_child_collapse_blocked_by_flex.rs | 26 ++ .../blockflex/blockflex_overflow_hidden.rs | 22 +- .../blockgrid/blockgrid_block_in_grid_auto.rs | 31 +- ..._block_in_grid_fixed_fit_content_larger.rs | 31 +- ..._block_in_grid_fixed_fit_content_middle.rs | 31 +- ...block_in_grid_fixed_fit_content_smaller.rs | 31 +- .../blockgrid_block_in_grid_fixed_larger.rs | 31 +- .../blockgrid_block_in_grid_fixed_middle.rs | 31 +- .../blockgrid_block_in_grid_fixed_smaller.rs | 31 +- .../blockgrid/blockgrid_block_in_grid_fr.rs | 31 +- .../blockgrid_block_in_grid_max_content.rs | 31 +- .../blockgrid_block_in_grid_min_content.rs | 31 +- .../blockgrid/blockgrid_grid_in_block.rs | 25 +- ...rgin_y_collapse_through_blocked_by_grid.rs | 14 + ..._y_first_child_collapse_blocked_by_grid.rs | 26 ++ ...n_y_last_child_collapse_blocked_by_grid.rs | 26 ++ ...ct_ratio_overrides_height_of_full_inset.rs | 10 + .../flex/absolute_aspect_ratio_fill_height.rs | 10 + ...ute_aspect_ratio_fill_height_from_inset.rs | 10 + .../absolute_aspect_ratio_fill_max_height.rs | 16 + .../absolute_aspect_ratio_fill_max_width.rs | 16 + .../absolute_aspect_ratio_fill_min_height.rs | 10 + .../absolute_aspect_ratio_fill_min_width.rs | 10 + .../flex/absolute_aspect_ratio_fill_width.rs | 10 + ...lute_aspect_ratio_fill_width_from_inset.rs | 10 + ...ute_aspect_ratio_height_overrides_inset.rs | 10 + ...lute_aspect_ratio_width_overrides_inset.rs | 10 + .../flex/absolute_child_with_cross_margin.rs | 20 ++ .../flex/absolute_child_with_main_margin.rs | 10 + .../flex/absolute_child_with_max_height.rs | 18 + ...max_height_larger_shrinkable_grandchild.rs | 18 + ..._align_items_and_justify_content_center.rs | 10 + ...tify_content_center_and_bottom_position.rs | 10 + ...ustify_content_center_and_left_position.rs | 10 + ...stify_content_center_and_right_position.rs | 10 + ...justify_content_center_and_top_position.rs | 10 + ...lign_items_and_justify_content_flex_end.rs | 10 + .../absolute_layout_align_items_center.rs | 10 + ...layout_align_items_center_on_child_only.rs | 10 + .../flex/absolute_layout_child_order.rs | 14 + ...layout_in_wrap_reverse_column_container.rs | 10 + ..._wrap_reverse_column_container_flex_end.rs | 10 + ...te_layout_in_wrap_reverse_row_container.rs | 10 + ..._in_wrap_reverse_row_container_flex_end.rs | 10 + .../absolute_layout_justify_content_center.rs | 10 + .../generated/flex/absolute_layout_no_size.rs | 15 +- ...ercentage_bottom_based_on_parent_height.rs | 14 + .../flex/absolute_layout_percentage_height.rs | 10 + ...lute_layout_row_width_height_end_bottom.rs | 10 + .../absolute_layout_start_top_end_bottom.rs | 10 + ...absolute_layout_width_height_end_bottom.rs | 10 + .../absolute_layout_width_height_start_top.rs | 10 + ...ayout_width_height_start_top_end_bottom.rs | 10 + .../flex/absolute_layout_within_border.rs | 16 + .../flex/absolute_margin_bottom_left.rs | 10 + .../flex/absolute_minmax_bottom_right_max.rs | 10 + .../absolute_minmax_bottom_right_min_max.rs | 10 + ...e_minmax_bottom_right_min_max_preferred.rs | 10 + ...solute_minmax_top_left_bottom_right_max.rs | 10 + ...te_minmax_top_left_bottom_right_min_max.rs | 10 + ...olute_padding_border_overrides_max_size.rs | 24 +- .../absolute_padding_border_overrides_size.rs | 24 +- .../flex/absolute_resolved_insets.rs | 54 ++- tests/generated/flex/align_baseline.rs | 12 + tests/generated/flex/align_baseline_child.rs | 20 ++ .../flex/align_baseline_child_margin.rs | 20 ++ .../align_baseline_child_margin_percent.rs | 20 ++ .../flex/align_baseline_child_multiline.rs | 26 ++ ...ild_multiline_no_override_on_secondline.rs | 26 ++ ...align_baseline_child_multiline_override.rs | 26 ++ .../flex/align_baseline_child_padding.rs | 20 ++ .../flex/align_baseline_child_top.rs | 20 ++ .../flex/align_baseline_child_top2.rs | 20 ++ tests/generated/flex/align_baseline_column.rs | 12 + .../align_baseline_double_nested_child.rs | 28 ++ .../flex/align_baseline_multiline.rs | 32 ++ .../flex/align_baseline_multiline_column.rs | 32 ++ .../flex/align_baseline_multiline_column2.rs | 32 ++ ...align_baseline_multiline_row_and_column.rs | 32 ++ .../flex/align_baseline_nested_child.rs | 20 ++ .../flex/align_baseline_nested_column.rs | 35 +- ...ign_center_should_size_based_on_content.rs | 35 +- .../flex/align_content_center_single_line.rs | 20 ++ ...ntent_center_single_line_negative_space.rs | 18 + ...t_center_single_line_negative_space_gap.rs | 18 + .../flex/align_content_center_wrapped.rs | 20 ++ ...n_content_center_wrapped_negative_space.rs | 22 ++ ...ntent_center_wrapped_negative_space_gap.rs | 22 ++ tests/generated/flex/align_content_end.rs | 18 + ..._content_end_single_line_negative_space.rs | 18 + ...tent_end_single_line_negative_space_gap.rs | 18 + ...lign_content_end_wrapped_negative_space.rs | 22 ++ ..._content_end_wrapped_negative_space_gap.rs | 22 ++ .../generated/flex/align_content_flex_end.rs | 18 + .../flex/align_content_flex_start.rs | 18 + .../align_content_flex_start_with_flex.rs | 18 + ...t_flex_start_without_height_on_children.rs | 18 + ...nt_not_stretch_with_align_items_stretch.rs | 38 +- .../align_content_space_around_single_line.rs | 20 ++ ...space_around_single_line_negative_space.rs | 18 + ...e_around_single_line_negative_space_gap.rs | 18 + .../align_content_space_around_wrapped.rs | 20 ++ ...ent_space_around_wrapped_negative_space.rs | 22 ++ ...space_around_wrapped_negative_space_gap.rs | 22 ++ ...ign_content_space_around_wrapped_single.rs | 10 + ...align_content_space_between_single_line.rs | 20 ++ ...pace_between_single_line_negative_space.rs | 18 + ..._between_single_line_negative_space_gap.rs | 18 + .../align_content_space_between_wrapped.rs | 20 ++ ...nt_space_between_wrapped_negative_space.rs | 22 ++ ...pace_between_wrapped_negative_space_gap.rs | 22 ++ ...gn_content_space_between_wrapped_single.rs | 10 + .../align_content_space_evenly_single_line.rs | 20 ++ ...space_evenly_single_line_negative_space.rs | 18 + ...e_evenly_single_line_negative_space_gap.rs | 18 + .../align_content_space_evenly_wrapped.rs | 20 ++ ...ent_space_evenly_wrapped_negative_space.rs | 22 ++ ...space_evenly_wrapped_negative_space_gap.rs | 22 ++ ...ign_content_space_evenly_wrapped_single.rs | 10 + .../flex/align_content_spacearound.rs | 18 + .../flex/align_content_spacebetween.rs | 18 + tests/generated/flex/align_content_start.rs | 18 + ...ontent_start_single_line_negative_space.rs | 18 + ...nt_start_single_line_negative_space_gap.rs | 18 + ...gn_content_start_wrapped_negative_space.rs | 22 ++ tests/generated/flex/align_content_stretch.rs | 18 + .../flex/align_content_stretch_column.rs | 26 ++ ...t_stretch_is_not_overriding_align_items.rs | 23 +- .../flex/align_content_stretch_row.rs | 18 + ...align_content_stretch_row_with_children.rs | 26 ++ ...n_content_stretch_row_with_fixed_height.rs | 18 + .../align_content_stretch_row_with_flex.rs | 18 + ...content_stretch_row_with_flex_no_shrink.rs | 18 + .../align_content_stretch_row_with_margin.rs | 18 + ...ign_content_stretch_row_with_max_height.rs | 18 + ...ign_content_stretch_row_with_min_height.rs | 18 + .../align_content_stretch_row_with_padding.rs | 18 + ...ign_content_stretch_row_with_single_row.rs | 12 + .../flex/align_content_stretch_row_wrap.rs | 18 + ...lign_flex_start_with_shrinking_children.rs | 49 ++- ...rt_with_shrinking_children_with_stretch.rs | 40 ++- ...ign_flex_start_with_stretching_children.rs | 49 ++- tests/generated/flex/align_items_center.rs | 10 + ...er_child_with_margin_bigger_than_parent.rs | 23 +- ...child_without_margin_bigger_than_parent.rs | 23 +- ...ign_items_center_justify_content_center.rs | 32 ++ ...align_items_center_min_max_with_padding.rs | 10 + .../align_items_center_with_child_margin.rs | 10 + .../flex/align_items_center_with_child_top.rs | 10 + ...th_height_with_padding_border_with_wrap.rs | 46 ++- ...ercentage_with_align_content_flex_start.rs | 20 ++ ...ax_height_with_align_content_flex_start.rs | 12 + ...ter_with_max_height_with_padding_border.rs | 37 +- ...ercentage_with_align_content_flex_start.rs | 20 ++ ...in_height_with_align_content_flex_start.rs | 12 + ...with_align_content_flex_start_with_wrap.rs | 71 +++- ...ter_with_min_height_with_padding_border.rs | 46 ++- tests/generated/flex/align_items_flex_end.rs | 10 + ...nd_child_with_margin_bigger_than_parent.rs | 23 +- ...child_without_margin_bigger_than_parent.rs | 23 +- .../generated/flex/align_items_flex_start.rs | 10 + tests/generated/flex/align_items_min_max.rs | 10 + tests/generated/flex/align_items_stretch.rs | 10 + .../flex/align_items_stretch_min_cross.rs | 10 + tests/generated/flex/align_self_baseline.rs | 20 ++ tests/generated/flex/align_self_center.rs | 10 + .../align_self_center_undefined_max_height.rs | 12 + tests/generated/flex/align_self_flex_end.rs | 10 + ...align_self_flex_end_override_flex_start.rs | 10 + tests/generated/flex/align_self_flex_start.rs | 10 + ...ign_stretch_should_size_based_on_parent.rs | 35 +- tests/generated/flex/android_news_feed.rs | 100 ++++++ .../aspect_ratio_flex_column_fill_height.rs | 10 + ...spect_ratio_flex_column_fill_max_height.rs | 16 + ...aspect_ratio_flex_column_fill_max_width.rs | 16 + ...spect_ratio_flex_column_fill_min_height.rs | 10 + ...aspect_ratio_flex_column_fill_min_width.rs | 16 + .../aspect_ratio_flex_column_fill_width.rs | 10 + ...spect_ratio_flex_column_fill_width_flex.rs | 10 + ...t_ratio_flex_column_stretch_fill_height.rs | 10 + ...tio_flex_column_stretch_fill_max_height.rs | 16 + ...atio_flex_column_stretch_fill_max_width.rs | 16 + ...ct_ratio_flex_column_stretch_fill_width.rs | 10 + .../flex/aspect_ratio_flex_row_fill_height.rs | 10 + .../aspect_ratio_flex_row_fill_max_height.rs | 16 + .../aspect_ratio_flex_row_fill_max_width.rs | 16 + .../aspect_ratio_flex_row_fill_min_height.rs | 10 + .../aspect_ratio_flex_row_fill_min_width.rs | 16 + .../flex/aspect_ratio_flex_row_fill_width.rs | 10 + .../aspect_ratio_flex_row_fill_width_flex.rs | 10 + ...pect_ratio_flex_row_stretch_fill_height.rs | 10 + ..._ratio_flex_row_stretch_fill_max_height.rs | 16 + ...t_ratio_flex_row_stretch_fill_max_width.rs | 16 + ...spect_ratio_flex_row_stretch_fill_width.rs | 10 + .../generated/flex/bevy_issue_10343_block.rs | 42 ++- tests/generated/flex/bevy_issue_10343_flex.rs | 42 ++- tests/generated/flex/bevy_issue_10343_grid.rs | 42 ++- tests/generated/flex/bevy_issue_16304.rs | 36 +- tests/generated/flex/bevy_issue_21240.rs | 64 +++- .../generated/flex/bevy_issue_7976_3_level.rs | 18 + .../generated/flex/bevy_issue_7976_4_level.rs | 37 +- .../generated/flex/bevy_issue_7976_reduced.rs | 10 + tests/generated/flex/bevy_issue_8017.rs | 32 ++ .../generated/flex/bevy_issue_8017_reduced.rs | 50 ++- tests/generated/flex/bevy_issue_8082.rs | 24 ++ .../generated/flex/bevy_issue_8082_percent.rs | 24 ++ tests/generated/flex/bevy_issue_9530.rs | 30 ++ .../generated/flex/bevy_issue_9530_reduced.rs | 29 +- .../flex/bevy_issue_9530_reduced2.rs | 34 +- .../flex/bevy_issue_9530_reduced3.rs | 16 + .../flex/bevy_issue_9530_reduced4.rs | 16 + tests/generated/flex/blitz_issue_88.rs | 38 +- tests/generated/flex/border_center_child.rs | 10 + .../flex/border_container_match_child.rs | 10 + tests/generated/flex/border_flex_child.rs | 10 + tests/generated/flex/border_no_child.rs | 2 + tests/generated/flex/border_no_size.rs | 2 + tests/generated/flex/border_stretch_child.rs | 10 + .../flex/child_min_max_width_flexing.rs | 12 + .../flex/child_with_padding_align_end.rs | 10 + .../flex/container_with_unsized_child.rs | 21 +- tests/generated/flex/content_size.rs | 16 + .../flex/content_size_with_border.rs | 340 +++++++++++++++--- tests/generated/flex/display_none.rs | 25 +- .../flex/display_none_absolute_child.rs | 19 +- .../generated/flex/display_none_fixed_size.rs | 19 +- .../generated/flex/display_none_only_node.rs | 2 + .../generated/flex/display_none_with_child.rs | 22 ++ .../flex/display_none_with_margin.rs | 19 +- .../flex/display_none_with_position.rs | 19 +- .../display_none_with_position_absolute.rs | 10 + ...to_height_of_its_overflow_hidden_parent.rs | 10 + .../flex/flex_absolute_overflow_clip.rs | 10 +- .../flex/flex_absolute_overflow_hidden.rs | 8 + .../flex/flex_absolute_overflow_scroll.rs | 8 + .../flex/flex_absolute_overflow_visible.rs | 16 + ...x_basis_and_main_dimen_set_when_flexing.rs | 12 + .../flex/flex_basis_flex_grow_column.rs | 19 +- .../flex/flex_basis_flex_grow_row.rs | 19 +- .../flex/flex_basis_flex_shrink_column.rs | 17 +- .../flex/flex_basis_flex_shrink_row.rs | 17 +- .../flex_basis_larger_than_content_column.rs | 18 + .../flex_basis_larger_than_content_row.rs | 18 + .../flex/flex_basis_overrides_main_size.rs | 14 + ..._then_content_with_flex_grow_large_size.rs | 28 ++ .../flex_basis_smaller_than_content_column.rs | 18 + .../flex_basis_smaller_than_content_row.rs | 18 + ...ex_basis_smaller_than_main_dimen_column.rs | 10 + .../flex_basis_smaller_than_main_dimen_row.rs | 10 + ..._then_content_with_flex_grow_large_size.rs | 28 ++ ..._then_content_with_flex_grow_small_size.rs | 28 ++ ...ontent_with_flex_grow_unconstraint_size.rs | 42 ++- ..._content_with_flex_grow_very_large_size.rs | 28 ++ .../flex/flex_basis_unconstraint_column.rs | 15 +- .../flex/flex_basis_unconstraint_row.rs | 24 +- .../flex_basis_zero_undefined_main_size.rs | 32 +- .../flex/flex_column_relative_all_sides.rs | 10 + tests/generated/flex/flex_direction_column.rs | 14 + .../flex/flex_direction_column_no_height.rs | 14 + .../flex/flex_direction_column_reverse.rs | 14 + ...flex_direction_column_reverse_no_height.rs | 14 + tests/generated/flex/flex_direction_row.rs | 14 + .../flex/flex_direction_row_no_width.rs | 14 + .../flex/flex_direction_row_reverse.rs | 14 + tests/generated/flex/flex_grow_0_min_size.rs | 40 +++ tests/generated/flex/flex_grow_child.rs | 24 +- .../flex_grow_flex_basis_percent_min_max.rs | 12 + .../flex/flex_grow_height_maximized.rs | 20 ++ .../flex/flex_grow_in_at_most_container.rs | 32 +- .../flex/flex_grow_less_than_factor_one.rs | 32 +- .../flex/flex_grow_root_minimized.rs | 20 ++ .../flex/flex_grow_shrink_at_most.rs | 41 ++- tests/generated/flex/flex_grow_to_min.rs | 21 +- ...flex_grow_within_constrained_max_column.rs | 12 + .../flex_grow_within_constrained_max_row.rs | 20 ++ .../flex_grow_within_constrained_max_width.rs | 18 + ...flex_grow_within_constrained_min_column.rs | 19 +- ..._grow_within_constrained_min_max_column.rs | 19 +- .../flex_grow_within_constrained_min_row.rs | 19 +- .../flex/flex_grow_within_max_width.rs | 18 + .../flex/flex_inflow_overflow_clip.rs | 10 +- .../flex/flex_inflow_overflow_hidden.rs | 8 + .../flex/flex_inflow_overflow_scroll.rs | 8 + .../flex/flex_inflow_overflow_visible.rs | 16 + tests/generated/flex/flex_root_ignored.rs | 12 + .../flex/flex_row_relative_all_sides.rs | 10 + ...ex_shrink_by_outer_margin_with_max_size.rs | 10 + ...flex_grow_child_flex_shrink_other_child.rs | 12 + .../flex/flex_shrink_flex_grow_row.rs | 12 + tests/generated/flex/flex_shrink_to_zero.rs | 14 + .../flex_wrap_align_stretch_fits_one_row.rs | 12 + ...ren_with_min_main_overriding_flex_basis.rs | 12 + .../flex/flex_wrap_wrap_to_child_height.rs | 33 +- .../flex/gap_column_gap_child_margins.rs | 14 + .../gap_column_gap_determines_parent_width.rs | 14 + .../generated/flex/gap_column_gap_flexible.rs | 14 + ...ap_column_gap_flexible_undefined_parent.rs | 14 + .../flex/gap_column_gap_inflexible.rs | 14 + ..._column_gap_inflexible_undefined_parent.rs | 14 + .../flex/gap_column_gap_justify_center.rs | 14 + .../flex/gap_column_gap_justify_flex_end.rs | 14 + .../flex/gap_column_gap_justify_flex_start.rs | 14 + .../gap_column_gap_justify_space_around.rs | 14 + .../gap_column_gap_justify_space_between.rs | 14 + .../gap_column_gap_justify_space_evenly.rs | 14 + .../flex/gap_column_gap_mixed_flexible.rs | 14 + ..._percentage_cyclic_partially_shrinkable.rs | 14 + ...column_gap_percentage_cyclic_shrinkable.rs | 14 + ...lumn_gap_percentage_cyclic_unshrinkable.rs | 14 + .../gap_column_gap_percentage_flexible.rs | 14 + ...mn_gap_percentage_flexible_with_padding.rs | 14 + .../gap_column_gap_percentage_inflexible.rs | 14 + .../flex/gap_column_gap_row_gap_wrapping.rs | 26 ++ .../flex/gap_column_gap_start_index.rs | 16 + .../flex/gap_column_gap_wrap_align_center.rs | 20 ++ .../gap_column_gap_wrap_align_flex_end.rs | 20 ++ .../gap_column_gap_wrap_align_flex_start.rs | 20 ++ .../gap_column_gap_wrap_align_space_around.rs | 20 ++ ...gap_column_gap_wrap_align_space_between.rs | 20 ++ .../flex/gap_column_gap_wrap_align_stretch.rs | 18 + .../flex/gap_column_row_gap_wrapping.rs | 26 ++ .../flex/gap_row_gap_align_items_end.rs | 20 ++ .../flex/gap_row_gap_align_items_stretch.rs | 20 ++ .../flex/gap_row_gap_column_child_margins.rs | 14 + .../gap_row_gap_determines_parent_height.rs | 14 + .../flex/gap_row_gap_percentage_wrapping.rs | 26 ++ .../gap_row_gap_row_wrap_child_margins.rs | 14 + .../intrinsic_sizing_cross_size_column.rs | 13 +- .../flex/intrinsic_sizing_main_size_column.rs | 13 +- ...ntrinsic_sizing_main_size_column_nested.rs | 26 +- .../intrinsic_sizing_main_size_column_wrap.rs | 34 +- .../intrinsic_sizing_main_size_min_size.rs | 18 + .../flex/intrinsic_sizing_main_size_row.rs | 17 +- .../intrinsic_sizing_main_size_row_nested.rs | 39 +- .../intrinsic_sizing_main_size_row_wrap.rs | 47 ++- .../flex/justify_content_column_center.rs | 14 + ...fy_content_column_center_negative_space.rs | 22 ++ ...ontent_column_center_negative_space_gap.rs | 22 ++ .../flex/justify_content_column_end.rs | 14 + ...stify_content_column_end_negative_space.rs | 22 ++ ...y_content_column_end_negative_space_gap.rs | 22 ++ .../justify_content_column_end_reverse.rs | 14 + .../flex/justify_content_column_flex_end.rs | 14 + ...justify_content_column_flex_end_reverse.rs | 14 + .../flex/justify_content_column_flex_start.rs | 14 + ...stify_content_column_flex_start_reverse.rs | 14 + ...fy_content_column_max_height_and_margin.rs | 32 +- ...fy_content_column_min_height_and_margin.rs | 32 +- ...ent_column_min_height_and_margin_bottom.rs | 10 + ...ontent_column_min_height_and_margin_top.rs | 10 + .../justify_content_column_space_around.rs | 14 + ...tent_column_space_around_negative_space.rs | 22 ++ ..._column_space_around_negative_space_gap.rs | 22 ++ .../justify_content_column_space_between.rs | 14 + ...ent_column_space_between_negative_space.rs | 22 ++ ...column_space_between_negative_space_gap.rs | 22 ++ .../justify_content_column_space_evenly.rs | 14 + ...tent_column_space_evenly_negative_space.rs | 22 ++ ..._column_space_evenly_negative_space_gap.rs | 22 ++ .../flex/justify_content_column_start.rs | 14 + ...ify_content_column_start_negative_space.rs | 22 ++ ...content_column_start_negative_space_gap.rs | 22 ++ .../justify_content_column_start_reverse.rs | 14 + .../generated/flex/justify_content_min_max.rs | 10 + ...padding_child_width_greater_than_parent.rs | 31 +- ...h_padding_child_width_lower_than_parent.rs | 31 +- .../flex/justify_content_overflow_min_max.rs | 14 + .../flex/justify_content_row_center.rs | 14 + .../flex/justify_content_row_flex_end.rs | 14 + .../flex/justify_content_row_flex_start.rs | 14 + ...ustify_content_row_max_width_and_margin.rs | 10 + ...ustify_content_row_min_width_and_margin.rs | 10 + .../flex/justify_content_row_space_around.rs | 14 + .../flex/justify_content_row_space_between.rs | 14 + .../flex/justify_content_row_space_evenly.rs | 14 + .../generated/flex/margin_and_flex_column.rs | 10 + tests/generated/flex/margin_and_flex_row.rs | 10 + .../flex/margin_and_stretch_column.rs | 10 + .../generated/flex/margin_and_stretch_row.rs | 10 + tests/generated/flex/margin_auto_bottom.rs | 12 + .../flex/margin_auto_bottom_and_top.rs | 12 + ...rgin_auto_bottom_and_top_justify_center.rs | 12 + tests/generated/flex/margin_auto_left.rs | 12 + .../flex/margin_auto_left_and_right.rs | 12 + .../flex/margin_auto_left_and_right_column.rs | 12 + ...n_auto_left_and_right_column_and_center.rs | 12 + .../margin_auto_left_and_right_stretch.rs | 12 + ...rgin_auto_left_child_bigger_than_parent.rs | 10 + ...left_fix_right_child_bigger_than_parent.rs | 10 + ...uto_left_right_child_bigger_than_parent.rs | 10 + .../flex/margin_auto_left_stretching_child.rs | 12 + .../margin_auto_multiple_children_column.rs | 14 + .../flex/margin_auto_multiple_children_row.rs | 14 + tests/generated/flex/margin_auto_right.rs | 12 + tests/generated/flex/margin_auto_top.rs | 12 + .../margin_auto_top_and_bottom_stretch.rs | 12 + .../flex/margin_auto_top_stretching_child.rs | 12 + tests/generated/flex/margin_bottom.rs | 10 + ...eft_auto_right_child_bigger_than_parent.rs | 10 + tests/generated/flex/margin_left.rs | 10 + tests/generated/flex/margin_right.rs | 10 + ...margin_should_not_be_part_of_max_height.rs | 10 + .../margin_should_not_be_part_of_max_width.rs | 10 + tests/generated/flex/margin_top.rs | 10 + .../flex/margin_with_sibling_column.rs | 19 +- .../generated/flex/margin_with_sibling_row.rs | 19 +- tests/generated/flex/max_height.rs | 10 + .../flex/max_height_overrides_height.rs | 24 +- .../max_height_overrides_height_on_root.rs | 2 + tests/generated/flex/max_width.rs | 10 + .../flex/max_width_overrides_width.rs | 24 +- .../flex/max_width_overrides_width_on_root.rs | 2 + tests/generated/flex/measure_child.rs | 39 +- .../generated/flex/measure_child_absolute.rs | 21 +- .../flex/measure_child_constraint.rs | 25 +- ...measure_child_constraint_padding_parent.rs | 25 +- .../flex/measure_child_with_flex_grow.rs | 27 +- .../flex/measure_child_with_flex_shrink.rs | 27 +- .../measure_child_with_flex_shrink_hidden.rs | 10 + ...h_min_size_greater_than_available_space.rs | 16 + .../measure_flex_basis_overrides_measure.rs | 25 +- .../flex/measure_height_overrides_measure.rs | 30 +- .../measure_remeasure_child_after_growing.rs | 27 +- ...measure_remeasure_child_after_shrinking.rs | 27 +- ...easure_remeasure_child_after_stretching.rs | 25 +- tests/generated/flex/measure_root.rs | 17 +- .../flex/measure_stretch_overrides_measure.rs | 18 + .../flex/measure_width_overrides_measure.rs | 30 +- tests/generated/flex/min_height.rs | 19 +- .../flex/min_height_larger_than_height.rs | 10 + .../flex/min_height_overrides_height.rs | 24 +- .../min_height_overrides_height_on_root.rs | 2 + .../flex/min_height_overrides_max_height.rs | 24 +- .../min_height_with_nested_fixed_height.rs | 18 + .../min_max_percent_different_width_height.rs | 16 + .../flex/min_max_percent_no_width_height.rs | 10 + tests/generated/flex/min_width.rs | 19 +- .../flex/min_width_larger_than_width.rs | 10 + .../flex/min_width_overrides_max_width.rs | 24 +- .../flex/min_width_overrides_width.rs | 24 +- .../flex/min_width_overrides_width_on_root.rs | 2 + .../flex/multiline_column_max_height.rs | 48 +++ tests/generated/flex/multiline_min_max_12.rs | 16 + tests/generated/flex/multiline_min_max_13.rs | 16 + tests/generated/flex/multiline_min_max_14.rs | 16 + tests/generated/flex/multiline_min_max_5.rs | 16 + tests/generated/flex/multiline_min_max_8.rs | 16 + .../flex/nested_overflowing_child.rs | 32 +- ..._overflowing_child_in_constraint_parent.rs | 18 + ...ly_shrinkable_item_with_flex_basis_zero.rs | 14 + tests/generated/flex/overflow_cross_axis.rs | 10 + tests/generated/flex/overflow_main_axis.rs | 10 + .../flex/overflow_main_axis_shrink_hidden.rs | 8 + .../flex/overflow_main_axis_shrink_scroll.rs | 8 + .../flex/overflow_main_axis_shrink_visible.rs | 21 +- ...ow_scroll_main_axis_justify_content_end.rs | 10 + ...crollbars_overridden_by_available_space.rs | 17 +- ...rflow_scrollbars_overridden_by_max_size.rs | 9 +- .../overflow_scrollbars_overridden_by_size.rs | 9 +- ...flow_scrollbars_take_up_space_both_axis.rs | 9 +- ...low_scrollbars_take_up_space_cross_axis.rs | 9 +- ...flow_scrollbars_take_up_space_main_axis.rs | 9 +- .../generated/flex/padding_align_end_child.rs | 10 + .../flex/padding_border_overrides_max_size.rs | 24 +- .../flex/padding_border_overrides_min_size.rs | 24 +- .../flex/padding_border_overrides_size.rs | 24 +- ...er_overrides_size_flex_basis_0_growable.rs | 26 +- .../padding_border_overrides_size_root.rs | 21 +- tests/generated/flex/padding_center_child.rs | 10 + .../flex/padding_container_match_child.rs | 10 + tests/generated/flex/padding_flex_child.rs | 10 + tests/generated/flex/padding_no_child.rs | 2 + tests/generated/flex/padding_no_size.rs | 2 + tests/generated/flex/padding_stretch_child.rs | 10 + ...rent_wrap_child_size_overflowing_parent.rs | 18 + .../flex/percent_absolute_position.rs | 20 ++ .../flex/percent_within_flex_grow.rs | 22 ++ .../flex/percentage_absolute_position.rs | 10 + ...centage_container_in_wrapping_container.rs | 33 +- .../flex/percentage_different_width_height.rs | 12 + ...ercentage_different_width_height_column.rs | 19 +- tests/generated/flex/percentage_flex_basis.rs | 12 + .../flex/percentage_flex_basis_cross.rs | 12 + .../percentage_flex_basis_cross_max_height.rs | 12 + .../percentage_flex_basis_cross_max_width.rs | 12 + .../percentage_flex_basis_cross_min_height.rs | 12 + .../percentage_flex_basis_cross_min_width.rs | 12 + .../percentage_flex_basis_main_max_height.rs | 12 + .../percentage_flex_basis_main_max_width.rs | 12 + .../percentage_flex_basis_main_min_width.rs | 12 + .../flex/percentage_main_max_height.rs | 25 +- ...in_should_calculate_based_only_on_width.rs | 18 + .../flex/percentage_moderate_complexity.rs | 18 + .../flex/percentage_moderate_complexity2.rs | 18 + ...th_padding_margin_and_percentage_values.rs | 28 ++ ...ng_should_calculate_based_only_on_width.rs | 18 + .../flex/percentage_position_bottom_right.rs | 10 + .../flex/percentage_position_left_top.rs | 10 + ...centage_size_based_on_parent_inner_size.rs | 10 + .../flex/percentage_size_of_flex_basis.rs | 23 +- ...sizes_should_not_prevent_flex_shrinking.rs | 29 +- .../generated/flex/percentage_width_height.rs | 10 + ...tage_width_height_undefined_parent_size.rs | 15 +- ...th_rtl_should_position_withoutdirection.rs | 24 +- ...tive_position_should_not_nudge_siblings.rs | 12 + ..._basis_flex_grow_row_prime_number_width.rs | 53 ++- ...g_flex_basis_flex_grow_row_width_of_100.rs | 35 +- .../rounding_flex_basis_flex_shrink_row.rs | 24 +- ...rounding_flex_basis_overrides_main_size.rs | 14 + .../flex/rounding_fractial_input_1.rs | 14 + .../flex/rounding_fractial_input_2.rs | 14 + .../flex/rounding_fractial_input_3.rs | 14 + .../flex/rounding_fractial_input_4.rs | 14 + .../flex/rounding_fractial_input_5.rs | 12 + .../flex/rounding_fractial_input_6.rs | 32 ++ .../flex/rounding_fractial_input_7.rs | 56 +++ ...ounding_inner_node_controversy_combined.rs | 34 ++ ...nding_inner_node_controversy_horizontal.rs | 22 ++ ...ounding_inner_node_controversy_vertical.rs | 22 ++ .../generated/flex/rounding_total_fractial.rs | 14 + .../flex/rounding_total_fractial_nested.rs | 24 ++ tests/generated/flex/scroll_size.rs | 2 + tests/generated/flex/simple_child.rs | 52 ++- .../single_flex_child_after_absolute_child.rs | 23 +- tests/generated/flex/size_defined_by_child.rs | 24 +- .../flex/size_defined_by_child_with_border.rs | 10 + .../size_defined_by_child_with_padding.rs | 10 + .../flex/size_defined_by_grand_child.rs | 46 ++- tests/generated/flex/taffy_issue_696.rs | 10 + .../flex/taffy_issue_696_flex_basis_20.rs | 10 + .../flex/taffy_issue_696_min_height.rs | 18 + .../flex/taffy_issue_696_no_flex_basis.rs | 10 + .../flex/taffy_issue_696_overflow_hidden.rs | 10 + .../flex/undefined_height_with_min_max.rs | 10 + .../flex/undefined_width_with_min_max.rs | 10 + .../flex/undefined_width_with_min_max_row.rs | 18 + ..._then_content_with_flex_grow_large_size.rs | 28 ++ ..._then_content_with_flex_grow_small_size.rs | 28 ++ ...ontent_with_flex_grow_unconstraint_size.rs | 42 ++- ..._content_with_flex_grow_very_large_size.rs | 28 ++ tests/generated/flex/wrap_child.rs | 15 +- tests/generated/flex/wrap_column.rs | 16 + tests/generated/flex/wrap_grandchild.rs | 46 ++- ..._nodes_with_content_sizing_margin_cross.rs | 41 ++- ..._with_content_sizing_overflowing_margin.rs | 41 ++- tests/generated/flex/wrap_reverse_column.rs | 16 + .../flex/wrap_reverse_column_fixed_size.rs | 18 + tests/generated/flex/wrap_reverse_row.rs | 16 + .../wrap_reverse_row_align_content_center.rs | 18 + ...ap_reverse_row_align_content_flex_start.rs | 18 + ..._reverse_row_align_content_space_around.rs | 18 + .../wrap_reverse_row_align_content_stretch.rs | 18 + ..._reverse_row_single_line_different_size.rs | 18 + tests/generated/flex/wrap_row.rs | 16 + .../flex/wrap_row_align_items_center.rs | 16 + .../flex/wrap_row_align_items_flex_end.rs | 16 + .../flex/wrapped_column_max_height.rs | 14 + .../flex/wrapped_column_max_height_flex.rs | 14 + .../wrapped_row_within_align_items_center.rs | 25 +- ...wrapped_row_within_align_items_flex_end.rs | 25 +- ...apped_row_within_align_items_flex_start.rs | 25 +- .../generated/grid/chrome_issue_325928327.rs | 18 + .../grid_absolute_align_self_sized_all.rs | 24 ++ .../grid/grid_absolute_column_end.rs | 10 + .../grid/grid_absolute_column_start.rs | 10 + .../grid_absolute_container_bottom_left.rs | 114 +++++- ...d_absolute_container_bottom_left_margin.rs | 114 +++++- ...absolute_container_left_overrides_right.rs | 114 +++++- .../grid_absolute_container_left_right.rs | 114 +++++- ...id_absolute_container_left_right_margin.rs | 114 +++++- ...id_absolute_container_negative_position.rs | 103 +++++- ...lute_container_negative_position_margin.rs | 103 +++++- .../grid_absolute_container_top_bottom.rs | 114 +++++- ...id_absolute_container_top_bottom_margin.rs | 114 +++++- .../grid/grid_absolute_container_top_right.rs | 114 +++++- ...rid_absolute_container_top_right_margin.rs | 114 +++++- .../grid_absolute_justify_self_sized_all.rs | 24 ++ .../grid_absolute_layout_within_border.rs | 16 + ...id_absolute_layout_within_border_static.rs | 16 + .../grid/grid_absolute_overflow_clip.rs | 10 +- .../grid/grid_absolute_overflow_hidden.rs | 8 + .../grid/grid_absolute_overflow_scroll.rs | 8 + .../grid/grid_absolute_overflow_visible.rs | 16 + .../grid/grid_absolute_resolved_insets.rs | 54 ++- tests/generated/grid/grid_absolute_row_end.rs | 10 + .../generated/grid/grid_absolute_row_start.rs | 10 + .../grid_absolute_top_overrides_bottom.rs | 114 +++++- .../grid/grid_absolute_with_padding.rs | 103 +++++- .../grid_absolute_with_padding_and_margin.rs | 103 +++++- .../grid/grid_align_content_center.rs | 125 ++++++- ...align_content_center_negative_space_gap.rs | 133 ++++++- .../generated/grid/grid_align_content_end.rs | 125 ++++++- ...id_align_content_end_negative_space_gap.rs | 133 ++++++- ...d_align_content_end_with_padding_border.rs | 125 ++++++- .../grid/grid_align_content_space_around.rs | 125 ++++++- ...content_space_around_negative_space_gap.rs | 133 ++++++- ...ontent_space_around_with_padding_border.rs | 125 ++++++- .../grid/grid_align_content_space_between.rs | 125 ++++++- ...ontent_space_between_negative_space_gap.rs | 133 ++++++- ...ntent_space_between_with_padding_border.rs | 125 ++++++- .../grid/grid_align_content_space_evenly.rs | 125 ++++++- ...content_space_evenly_negative_space_gap.rs | 133 ++++++- ...ontent_space_evenly_with_padding_border.rs | 125 ++++++- .../grid/grid_align_content_start.rs | 125 ++++++- ..._align_content_start_negative_space_gap.rs | 133 ++++++- ...align_content_start_with_padding_border.rs | 125 ++++++- .../grid/grid_align_items_baseline.rs | 12 + .../grid/grid_align_items_baseline_child.rs | 20 ++ .../grid_align_items_baseline_child_margin.rs | 20 ++ ...ign_items_baseline_child_margin_percent.rs | 20 ++ ...id_align_items_baseline_child_multiline.rs | 26 ++ ...ild_multiline_no_override_on_secondline.rs | 26 ++ ...items_baseline_child_multiline_override.rs | 26 ++ ...grid_align_items_baseline_child_padding.rs | 20 ++ .../grid_align_items_baseline_child_top.rs | 20 ++ .../grid_align_items_baseline_child_top2.rs | 20 ++ .../grid/grid_align_items_baseline_complex.rs | 58 +++ ...lign_items_baseline_double_nested_child.rs | 28 ++ .../grid_align_items_baseline_multiline.rs | 32 ++ ...d_align_items_baseline_multiline_column.rs | 32 ++ ...items_baseline_multiline_row_and_column.rs | 32 ++ ...grid_align_items_baseline_nested_column.rs | 35 +- .../grid/grid_align_items_sized_center.rs | 12 + .../grid/grid_align_items_sized_end.rs | 12 + .../grid/grid_align_items_sized_start.rs | 12 + .../grid/grid_align_items_sized_stretch.rs | 12 + .../grid/grid_align_self_sized_all.rs | 24 ++ ...ct_ratio_overrides_height_of_full_inset.rs | 10 + ...t_ratio_absolute_fill_height_from_inset.rs | 10 + ...ct_ratio_absolute_fill_width_from_inset.rs | 10 + ...t_ratio_absolute_height_overrides_inset.rs | 10 + ...ct_ratio_absolute_width_overrides_inset.rs | 10 + ..._aspect_ratio_child_fill_content_height.rs | 28 +- ...d_aspect_ratio_child_fill_content_width.rs | 28 +- .../grid_aspect_ratio_fill_child_height.rs | 10 + ...grid_aspect_ratio_fill_child_max_height.rs | 16 + .../grid_aspect_ratio_fill_child_max_width.rs | 16 + ...grid_aspect_ratio_fill_child_min_height.rs | 10 + .../grid_aspect_ratio_fill_child_width.rs | 10 + ...pect_ratio_overridden_by_explicit_sizes.rs | 10 + ...ratio_overridden_by_explicit_sizes_flex.rs | 10 + tests/generated/grid/grid_auto_columns.rs | 101 +++++- .../grid/grid_auto_columns_fixed_width.rs | 216 +++++++++-- .../grid/grid_auto_fill_fixed_size.rs | 125 ++++++- .../grid_auto_fill_with_empty_auto_track.rs | 34 +- .../grid/grid_auto_fit_definite_percentage.rs | 96 ++++- .../grid_auto_fit_with_empty_auto_track.rs | 34 +- tests/generated/grid/grid_auto_rows.rs | 101 +++++- tests/generated/grid/grid_auto_single_item.rs | 114 +++++- .../grid/grid_auto_single_item_fixed_width.rs | 114 +++++- ...le_item_fixed_width_with_definite_width.rs | 114 +++++- .../grid_auto_takes_precedence_over_fr.rs | 34 +- ...vailable_space_greater_than_max_content.rs | 42 ++- ...vailable_space_smaller_than_max_content.rs | 42 ++- ...vailable_space_smaller_than_min_content.rs | 42 ++- tests/generated/grid/grid_basic.rs | 125 ++++++- .../grid/grid_basic_implicit_tracks.rs | 23 +- .../grid/grid_basic_with_overflow.rs | 138 +++++-- .../generated/grid/grid_basic_with_padding.rs | 125 ++++++- .../grid/grid_display_none_fixed_size.rs | 19 +- ...d_fit_content_percent_definite_argument.rs | 25 +- ...it_content_percent_definite_max_content.rs | 25 +- ...it_content_percent_definite_min_content.rs | 25 +- ...fit_content_percent_indefinite_argument.rs | 25 +- ..._content_percent_indefinite_max_content.rs | 25 +- ...t_percent_indefinite_max_content_hidden.rs | 8 + ..._content_percent_indefinite_min_content.rs | 25 +- ...t_percent_indefinite_min_content_hidden.rs | 8 + .../grid/grid_fit_content_points_argument.rs | 25 +- .../grid_fit_content_points_max_content.rs | 25 +- .../grid_fit_content_points_min_content.rs | 25 +- ...d_fit_content_points_min_content_hidden.rs | 8 + ...id_fr_fixed_size_no_content_proportions.rs | 47 ++- ...d_size_no_content_proportions_sub_1_sum.rs | 34 +- .../grid/grid_fr_fixed_size_single_item.rs | 114 +++++- .../grid/grid_fr_no_sized_items_indefinite.rs | 125 ++++++- .../grid/grid_fr_single_item_indefinite.rs | 114 +++++- .../grid/grid_fr_span_2_proportion.rs | 36 +- .../grid_fr_span_2_proportion_sub_1_sum.rs | 36 +- ...pan_2_proportion_with_non_spanned_track.rs | 62 +++- .../grid_fr_span_2_proportion_zero_sum.rs | 36 +- ...portion_zero_sum_with_non_spanned_track.rs | 62 +++- tests/generated/grid/grid_gap.rs | 125 ++++++- tests/generated/grid/grid_hidden.rs | 116 +++++- .../grid/grid_inflow_overflow_clip.rs | 10 +- .../grid/grid_inflow_overflow_hidden.rs | 8 + .../grid/grid_inflow_overflow_scroll.rs | 8 + .../grid/grid_inflow_overflow_visible.rs | 16 + .../grid/grid_justify_content_center.rs | 125 ++++++- ...stify_content_center_negative_space_gap.rs | 133 ++++++- ...tify_content_center_with_padding_border.rs | 125 ++++++- .../grid/grid_justify_content_end.rs | 125 ++++++- ..._justify_content_end_negative_space_gap.rs | 133 ++++++- ...justify_content_end_with_padding_border.rs | 125 ++++++- .../grid/grid_justify_content_space_around.rs | 125 ++++++- ...content_space_around_negative_space_gap.rs | 133 ++++++- ...ontent_space_around_with_padding_border.rs | 125 ++++++- .../grid_justify_content_space_between.rs | 125 ++++++- ...ontent_space_between_negative_space_gap.rs | 133 ++++++- ...ntent_space_between_with_padding_border.rs | 125 ++++++- .../grid/grid_justify_content_space_evenly.rs | 125 ++++++- ...content_space_evenly_negative_space_gap.rs | 133 ++++++- ...ontent_space_evenly_with_padding_border.rs | 125 ++++++- .../grid/grid_justify_content_start.rs | 125 ++++++- ...ustify_content_start_negative_space_gap.rs | 133 ++++++- ...stify_content_start_with_padding_border.rs | 125 ++++++- .../grid/grid_justify_items_sized_center.rs | 12 + .../grid/grid_justify_items_sized_end.rs | 12 + .../grid/grid_justify_items_sized_start.rs | 12 + .../grid/grid_justify_items_sized_stretch.rs | 12 + .../grid/grid_justify_self_sized_all.rs | 24 ++ .../grid/grid_margins_auto_margins.rs | 92 ++++- ...d_margins_auto_margins_override_stretch.rs | 120 ++++++- .../grid/grid_margins_fixed_center.rs | 75 +++- .../generated/grid/grid_margins_fixed_end.rs | 75 +++- .../grid/grid_margins_fixed_start.rs | 75 +++- .../grid/grid_margins_fixed_stretch.rs | 75 +++- .../grid/grid_margins_percent_center.rs | 75 +++- .../grid/grid_margins_percent_end.rs | 75 +++- .../grid/grid_margins_percent_start.rs | 75 +++- .../grid/grid_margins_percent_stretch.rs | 75 +++- .../grid_max_content_maximum_single_item.rs | 129 ++++++- .../grid/grid_max_content_single_item.rs | 129 ++++++- ...rid_max_content_single_item_margin_auto.rs | 120 ++++++- ...id_max_content_single_item_margin_fixed.rs | 120 ++++++- ..._max_content_single_item_margin_percent.rs | 120 ++++++- .../grid_max_content_single_item_span_2.rs | 120 ++++++- ...ax_content_single_item_span_2_gap_fixed.rs | 120 ++++++- ...single_item_span_2_gap_percent_definite.rs | 120 ++++++- ...ngle_item_span_2_gap_percent_indefinite.rs | 120 ++++++- ...grid_max_width_greater_than_max_content.rs | 50 ++- ..._less_than_max_content_with_min_content.rs | 50 ++- ...grid_max_width_smaller_than_max_content.rs | 50 ++- ...grid_max_width_smaller_than_min_content.rs | 50 ++- .../grid/grid_min_content_flex_column.rs | 67 +++- .../grid/grid_min_content_flex_row.rs | 72 +++- .../grid/grid_min_content_flex_single_item.rs | 96 ++++- ...in_content_flex_single_item_margin_auto.rs | 96 ++++- ...n_content_flex_single_item_margin_fixed.rs | 96 ++++- ...content_flex_single_item_margin_percent.rs | 96 ++++- .../grid_min_content_maximum_single_item.rs | 129 ++++++- .../grid/grid_min_content_single_item.rs | 129 ++++++- .../grid/grid_minmax_auto_fixed_10px.rs | 25 +- .../grid/grid_minmax_auto_max_content.rs | 25 +- .../grid/grid_minmax_auto_min_content.rs | 25 +- .../grid/grid_minmax_auto_percent_definite.rs | 25 +- .../grid_minmax_auto_percent_indefinite.rs | 25 +- ...d_minmax_column_fixed_width_above_range.rs | 125 ++++++- ...d_minmax_column_fixed_width_below_range.rs | 125 ++++++- ..._minmax_column_fixed_width_within_range.rs | 125 ++++++- .../grid/grid_minmax_column_indefinite.rs | 125 ++++++- .../grid_minmax_column_with_auto_fixed.rs | 34 +- .../grid/grid_minmax_column_with_fr_fixed.rs | 34 +- .../grid/grid_minmax_max_content_1fr.rs | 25 +- .../grid/grid_minmax_max_content_auto.rs | 25 +- .../grid_minmax_max_content_fixed_10px.rs | 25 +- .../grid_minmax_max_content_min_content.rs | 25 +- ...rid_minmax_max_content_percent_definite.rs | 25 +- ...d_minmax_max_content_percent_indefinite.rs | 25 +- .../grid/grid_minmax_min_content_1fr.rs | 25 +- .../grid/grid_minmax_min_content_auto.rs | 25 +- .../grid_minmax_min_content_fixed_10px.rs | 25 +- .../grid_minmax_min_content_max_content.rs | 25 +- ...rid_minmax_min_content_percent_definite.rs | 25 +- ...d_minmax_min_content_percent_indefinite.rs | 25 +- .../generated/grid/grid_out_of_order_items.rs | 92 ++++- .../grid/grid_overflow_inline_axis_hidden.rs | 8 + .../grid/grid_overflow_inline_axis_scroll.rs | 8 + .../grid/grid_overflow_inline_axis_visible.rs | 25 +- tests/generated/grid/grid_overflow_rows.rs | 81 ++++- ...crollbars_overridden_by_available_space.rs | 21 +- ...rflow_scrollbars_overridden_by_max_size.rs | 13 +- ..._overflow_scrollbars_overridden_by_size.rs | 13 +- ...flow_scrollbars_take_up_space_both_axis.rs | 13 +- ...verflow_scrollbars_take_up_space_x_axis.rs | 13 +- ...verflow_scrollbars_take_up_space_y_axis.rs | 13 +- ...ing_border_overrides_container_max_size.rs | 21 +- ...padding_border_overrides_container_size.rs | 21 +- .../grid_padding_border_overrides_max_size.rs | 18 +- .../grid_padding_border_overrides_min_size.rs | 18 +- .../grid_padding_border_overrides_size.rs | 18 +- .../grid_percent_item_inside_stretch_item.rs | 23 +- ...t_items_nested_inside_stretch_alignment.rs | 23 +- .../grid_percent_items_nested_moderate.rs | 18 + .../grid_percent_items_nested_with_margin.rs | 18 + ...ercent_items_nested_with_padding_margin.rs | 39 +- .../grid_percent_items_width_and_margin.rs | 10 + .../grid_percent_items_width_and_padding.rs | 10 + .../grid_percent_tracks_definite_overflow.rs | 86 ++++- .../grid_percent_tracks_definite_underflow.rs | 86 ++++- .../grid_percent_tracks_indefinite_only.rs | 86 ++++- ...tracks_indefinite_with_content_overflow.rs | 77 +++- ...racks_indefinite_with_content_underflow.rs | 77 +++- .../grid/grid_placement_auto_negative.rs | 25 +- ...ndary_axis_with_fully_definite_negative.rs | 14 + .../grid/grid_placement_definite_primary.rs | 18 + .../generated/grid/grid_relative_all_sides.rs | 10 + .../grid/grid_relayout_vertical_text.rs | 42 ++- tests/generated/grid/grid_repeat_integer.rs | 125 ++++++- tests/generated/grid/grid_repeat_mixed.rs | 125 ++++++- .../grid/grid_size_child_fixed_tracks.rs | 48 +++ ...13_most_non_flex_with_minmax_indefinite.rs | 185 ++++++++-- ..._non_flex_with_minmax_indefinite_hidden.rs | 177 +++++++-- ...grid_span_2_max_content_auto_indefinite.rs | 20 ++ ...an_2_max_content_auto_indefinite_hidden.rs | 12 + ...max_content_fit_content_10px_indefinite.rs | 20 ++ ...tent_fit_content_10px_indefinite_hidden.rs | 12 + ...max_content_fit_content_80px_indefinite.rs | 20 ++ ...tent_fit_content_80px_indefinite_hidden.rs | 12 + ...an_2_max_content_max_content_indefinite.rs | 20 ++ ...grid_span_2_min_content_auto_indefinite.rs | 42 ++- ...an_2_min_content_auto_indefinite_hidden.rs | 34 +- ...min_content_fit_content_10px_indefinite.rs | 20 ++ ...tent_fit_content_10px_indefinite_hidden.rs | 12 + ...min_content_fit_content_30px_indefinite.rs | 20 ++ ...tent_fit_content_30px_indefinite_hidden.rs | 12 + ...min_content_fit_content_80px_indefinite.rs | 20 ++ ...tent_fit_content_80px_indefinite_hidden.rs | 12 + ...an_2_min_content_max_content_indefinite.rs | 20 ++ ...an_2_min_content_min_content_indefinite.rs | 20 ++ .../grid_span_6_all_non_flex_indefinite.rs | 94 ++++- ...d_span_6_all_non_flex_indefinite_hidden.rs | 86 ++++- .../grid_span_8_all_track_types_indefinite.rs | 120 ++++++- tests/generated/grid/grid_taffy_issue_624.rs | 14 + .../gridflex/gridflex_column_integration.rs | 89 ++++- .../gridflex/gridflex_kitchen_sink.rs | 162 ++++++++- .../gridflex_kitchen_sink_minimise.rs | 45 ++- .../gridflex_kitchen_sink_minimise2.rs | 18 + .../gridflex_kitchen_sink_minimise3.rs | 57 ++- .../gridflex/gridflex_row_integration.rs | 98 ++++- tests/generated/leaf/leaf_overflow_clip.rs | 2 - .../leaf/leaf_overflow_clip_with_border.rs | 2 - ...f_overflow_clip_with_border_and_padding.rs | 2 - .../leaf/leaf_overflow_clip_with_padding.rs | 2 - ...crollbars_overridden_by_available_space.rs | 8 + tests/generated/leaf/leaf_overflow_visible.rs | 8 + .../leaf/leaf_overflow_visible_with_border.rs | 8 + ...verflow_visible_with_border_and_padding.rs | 8 + .../leaf_overflow_visible_with_padding.rs | 8 + .../leaf_padding_border_overrides_max_size.rs | 2 + .../leaf_padding_border_overrides_min_size.rs | 2 + .../leaf_padding_border_overrides_size.rs | 2 + .../leaf/leaf_with_content_and_border.rs | 8 + .../leaf/leaf_with_content_and_padding.rs | 8 + .../leaf_with_content_and_padding_border.rs | 8 + 1054 files changed, 28472 insertions(+), 2365 deletions(-) diff --git a/scripts/gentest/src/main.rs b/scripts/gentest/src/main.rs index 9a6f3fc79..0aee87afd 100644 --- a/scripts/gentest/src/main.rs +++ b/scripts/gentest/src/main.rs @@ -447,29 +447,25 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream { _ => quote!(), }; - fn quote_overflow(overflow: &Value) -> Option { + fn quote_overflow(overflow: &Value) -> (TokenStream, bool) { match overflow { Value::String(ref value) => match value.as_ref() { - "hidden" => Some(quote!(taffy::style::Overflow::Hidden)), - "scroll" => Some(quote!(taffy::style::Overflow::Scroll)), - "auto" => Some(quote!(taffy::style::Overflow::Auto)), - "clip" => Some(quote!(taffy::style::Overflow::Clip)), - "visible" => None, // None defaults to visible. - _ => None, + "hidden" => (quote!(taffy::style::Overflow::Hidden), true), + "scroll" => (quote!(taffy::style::Overflow::Scroll), true), + "auto" => (quote!(taffy::style::Overflow::Auto), true), + "clip" => (quote!(taffy::style::Overflow::Clip), false), + _ => (quote!(taffy::style::Overflow::Visible), false), }, - _ => None, + _ => (quote!(taffy::style::Overflow::Visible), false), } } - let overflow_x = quote_overflow(&style["overflowX"]); - let overflow_y = quote_overflow(&style["overflowY"]); - let (overflow, scrollbar_width) = if overflow_x.is_some() || overflow_y.is_some() { - let overflow_x = overflow_x.unwrap_or(quote!(taffy::style::Overflow::Visible)); - let overflow_y = overflow_y.unwrap_or(quote!(taffy::style::Overflow::Visible)); - let overflow = quote!(overflow: taffy::geometry::Point { x: #overflow_x, y: #overflow_y },); - let scrollbar_width = quote_number_prop("scrollbar_width", style, |value: f32| quote!(#value)); - (overflow, scrollbar_width) + let (overflow_x, x_scroll_container) = quote_overflow(&style["overflowX"]); + let (overflow_y, y_scroll_container) = quote_overflow(&style["overflowY"]); + let overflow = quote!(overflow: taffy::geometry::Point { x: #overflow_x, y: #overflow_y },); + let scrollbar_width = if x_scroll_container | y_scroll_container { + quote_number_prop("scrollbar_width", style, |value: f32| quote!(#value)) } else { - (quote!(), quote!()) + quote!() }; let text_align = match style["textAlign"] { 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 4176d8e26..fb5d58f34 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__bord let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -21,6 +22,10 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__bord .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__cont .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -147,6 +153,10 @@ fn block_absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__cont taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 6fd0bd56f..80e128378 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_height.rs @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn block_absolute_aspect_ratio_fill_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn block_absolute_aspect_ratio_fill_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn block_absolute_aspect_ratio_fill_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 0a3bfe265..ffac2d38b 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -21,6 +22,10 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -147,6 +153,10 @@ fn block_absolute_aspect_ratio_fill_height_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 e7636c27b..d4301a4a8 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 @@ -10,6 +10,10 @@ fn block_absolute_aspect_ratio_fill_max_height__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -21,6 +25,10 @@ fn block_absolute_aspect_ratio_fill_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -129,6 +137,10 @@ fn block_absolute_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -141,6 +153,10 @@ fn block_absolute_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 ab058bfd3..f6ab51e43 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 @@ -10,6 +10,10 @@ fn block_absolute_aspect_ratio_fill_max_width__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -21,6 +25,10 @@ fn block_absolute_aspect_ratio_fill_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -129,6 +137,10 @@ fn block_absolute_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -141,6 +153,10 @@ fn block_absolute_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 a78976455..3d9bcda30 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_min_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -16,6 +17,10 @@ fn block_absolute_aspect_ratio_fill_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn block_absolute_aspect_ratio_fill_min_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -131,6 +137,10 @@ fn block_absolute_aspect_ratio_fill_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 e0144e5ed..fc7a6996e 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_min_width__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -16,6 +17,10 @@ fn block_absolute_aspect_ratio_fill_min_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn block_absolute_aspect_ratio_fill_min_width__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -131,6 +137,10 @@ fn block_absolute_aspect_ratio_fill_min_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 733fb6941..83b0aa3ef 100644 --- a/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_absolute_aspect_ratio_fill_width.rs @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_width__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn block_absolute_aspect_ratio_fill_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn block_absolute_aspect_ratio_fill_width__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn block_absolute_aspect_ratio_fill_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 224aa8073..37d6ef180 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -131,6 +137,10 @@ fn block_absolute_aspect_ratio_fill_width_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 f6073599a..d0af5d7f9 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_height_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -17,6 +18,10 @@ fn block_absolute_aspect_ratio_height_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -122,6 +127,7 @@ fn block_absolute_aspect_ratio_height_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -133,6 +139,10 @@ fn block_absolute_aspect_ratio_height_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 ef51498e9..a83a65372 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 @@ -7,6 +7,7 @@ fn block_absolute_aspect_ratio_width_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn block_absolute_aspect_ratio_width_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn block_absolute_aspect_ratio_width_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn block_absolute_aspect_ratio_width_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 97ae0ad10..dd077549a 100644 --- a/tests/generated/block/block_absolute_child_with_margin_x.rs +++ b/tests/generated/block/block_absolute_child_with_margin_x.rs @@ -7,6 +7,7 @@ fn block_absolute_child_with_margin_x__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -18,6 +19,7 @@ fn block_absolute_child_with_margin_x__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -29,6 +31,7 @@ fn block_absolute_child_with_margin_x__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -41,6 +44,10 @@ fn block_absolute_child_with_margin_x__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), @@ -224,6 +231,7 @@ fn block_absolute_child_with_margin_x__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -236,6 +244,7 @@ fn block_absolute_child_with_margin_x__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -248,6 +257,7 @@ fn block_absolute_child_with_margin_x__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -261,6 +271,10 @@ fn block_absolute_child_with_margin_x__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), 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 4894caa35..6ab376ae0 100644 --- a/tests/generated/block/block_absolute_child_with_margin_y.rs +++ b/tests/generated/block/block_absolute_child_with_margin_y.rs @@ -7,6 +7,7 @@ fn block_absolute_child_with_margin_y__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -18,6 +19,7 @@ fn block_absolute_child_with_margin_y__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -29,6 +31,7 @@ fn block_absolute_child_with_margin_y__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -41,6 +44,10 @@ fn block_absolute_child_with_margin_y__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), @@ -224,6 +231,7 @@ fn block_absolute_child_with_margin_y__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -236,6 +244,7 @@ fn block_absolute_child_with_margin_y__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -248,6 +257,7 @@ fn block_absolute_child_with_margin_y__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -261,6 +271,10 @@ fn block_absolute_child_with_margin_y__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), 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 a3323ce96..079d925c0 100644 --- a/tests/generated/block/block_absolute_child_with_max_height.rs +++ b/tests/generated/block/block_absolute_child_with_max_height.rs @@ -7,6 +7,7 @@ fn block_absolute_child_with_max_height__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(150f32), @@ -19,6 +20,10 @@ fn block_absolute_child_with_max_height__border_box() { taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -30,6 +35,10 @@ fn block_absolute_child_with_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -186,6 +195,7 @@ fn block_absolute_child_with_max_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(150f32), @@ -199,6 +209,10 @@ fn block_absolute_child_with_max_height__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -211,6 +225,10 @@ fn block_absolute_child_with_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_absolute_layout_child_order.rs b/tests/generated/block/block_absolute_layout_child_order.rs index 173fae8e0..bff71cbe2 100644 --- a/tests/generated/block/block_absolute_layout_child_order.rs +++ b/tests/generated/block/block_absolute_layout_child_order.rs @@ -7,6 +7,7 @@ fn block_absolute_layout_child_order__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -18,6 +19,7 @@ fn block_absolute_layout_child_order__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -28,6 +30,7 @@ fn block_absolute_layout_child_order__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -39,6 +42,10 @@ fn block_absolute_layout_child_order__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -224,6 +231,7 @@ fn block_absolute_layout_child_order__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -236,6 +244,7 @@ fn block_absolute_layout_child_order__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -247,6 +256,7 @@ fn block_absolute_layout_child_order__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -259,6 +269,10 @@ fn block_absolute_layout_child_order__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/block/block_absolute_layout_no_size.rs b/tests/generated/block/block_absolute_layout_no_size.rs index ee1acbace..8abfeed21 100644 --- a/tests/generated/block/block_absolute_layout_no_size.rs +++ b/tests/generated/block/block_absolute_layout_no_size.rs @@ -5,12 +5,20 @@ fn block_absolute_layout_no_size__border_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }) + .new_leaf(taffy::style::Style { + position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -116,6 +124,7 @@ fn block_absolute_layout_no_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -124,6 +133,10 @@ fn block_absolute_layout_no_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 76f122928..4129a0b38 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 @@ -8,6 +8,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__border_box() .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -20,6 +21,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__border_box() .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -32,6 +34,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__border_box() .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.1f32), bottom: percent(0.1f32) }, ..Default::default() @@ -41,6 +44,10 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -231,6 +238,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__content_box() display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -244,6 +252,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__content_box() display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -257,6 +266,7 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__content_box() display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.1f32), bottom: percent(0.1f32) }, ..Default::default() @@ -267,6 +277,10 @@ fn block_absolute_layout_percentage_bottom_based_on_parent_height__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_absolute_layout_percentage_height.rs b/tests/generated/block/block_absolute_layout_percentage_height.rs index c2a22e5b1..811910557 100644 --- a/tests/generated/block/block_absolute_layout_percentage_height.rs +++ b/tests/generated/block/block_absolute_layout_percentage_height.rs @@ -7,6 +7,7 @@ fn block_absolute_layout_percentage_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -19,6 +20,10 @@ fn block_absolute_layout_percentage_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn block_absolute_layout_percentage_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -137,6 +143,10 @@ fn block_absolute_layout_percentage_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), 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 eb87a979b..5a9354879 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 @@ -7,6 +7,7 @@ fn block_absolute_layout_row_width_height_end_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -19,6 +20,10 @@ fn block_absolute_layout_row_width_height_end_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn block_absolute_layout_row_width_height_end_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -137,6 +143,10 @@ fn block_absolute_layout_row_width_height_end_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 a9c952e1d..7ac37cb01 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 @@ -8,6 +8,7 @@ fn block_absolute_layout_start_top_end_bottom__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -21,6 +22,10 @@ fn block_absolute_layout_start_top_end_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -127,6 +132,7 @@ fn block_absolute_layout_start_top_end_bottom__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -141,6 +147,10 @@ fn block_absolute_layout_start_top_end_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 d4c70b688..b220ff183 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 @@ -8,6 +8,7 @@ fn block_absolute_layout_width_height_end_bottom__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -20,6 +21,10 @@ fn block_absolute_layout_width_height_end_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -126,6 +131,7 @@ fn block_absolute_layout_width_height_end_bottom__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -139,6 +145,10 @@ fn block_absolute_layout_width_height_end_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 89dcc6481..dd13fe231 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 @@ -8,6 +8,7 @@ fn block_absolute_layout_width_height_start_top__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -20,6 +21,10 @@ fn block_absolute_layout_width_height_start_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -126,6 +131,7 @@ fn block_absolute_layout_width_height_start_top__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -139,6 +145,10 @@ fn block_absolute_layout_width_height_start_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 5a929401d..e90d17142 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 @@ -8,6 +8,7 @@ fn block_absolute_layout_width_height_start_top_end_bottom__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -25,6 +26,10 @@ fn block_absolute_layout_width_height_start_top_end_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -131,6 +136,7 @@ fn block_absolute_layout_width_height_start_top_end_bottom__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -149,6 +155,10 @@ fn block_absolute_layout_width_height_start_top_end_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_absolute_layout_within_border.rs b/tests/generated/block/block_absolute_layout_within_border.rs index 69b578b6e..da69b4274 100644 --- a/tests/generated/block/block_absolute_layout_within_border.rs +++ b/tests/generated/block/block_absolute_layout_within_border.rs @@ -8,6 +8,7 @@ fn block_absolute_layout_within_border__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -20,6 +21,7 @@ fn block_absolute_layout_within_border__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,7 @@ fn block_absolute_layout_within_border__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -50,6 +53,7 @@ fn block_absolute_layout_within_border__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -68,6 +72,10 @@ fn block_absolute_layout_within_border__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -303,6 +311,7 @@ fn block_absolute_layout_within_border__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -316,6 +325,7 @@ fn block_absolute_layout_within_border__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -329,6 +339,7 @@ fn block_absolute_layout_within_border__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -348,6 +359,7 @@ fn block_absolute_layout_within_border__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -367,6 +379,10 @@ fn block_absolute_layout_within_border__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 6e5f23b3a..4484b355d 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_bottom_and_top_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 2c4b44674..6c3f83d34 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_bottom_and_top_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 5a0747a9d..ab175308d 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_bottom_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_bottom_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -131,6 +136,7 @@ fn block_absolute_margin_auto_bottom_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -150,6 +156,10 @@ fn block_absolute_margin_auto_bottom_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 1c2bde275..f93ac8878 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_bottom_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_bottom_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_bottom_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -148,6 +154,10 @@ fn block_absolute_margin_auto_bottom_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 e89774d7a..dd85661e4 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_and_right_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_left_and_right_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_left_and_right_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_left_and_right_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 e0bd95bcb..0e4919e1b 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_and_right_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_left_and_right_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_left_and_right_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_left_and_right_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 73fbb16d4..cb0eb206c 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__border_b let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__border_b .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__content_ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_with_inset__content_ taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 5f00b80d3..0396c0076 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__borde let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__borde .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__conte .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_left_child_bigger_than_parent_without_inset__conte taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 07b4ef255..b5c10ba8f 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_with_inset taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 3db50fc8b..dcf600bed 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_left_fix_right_child_bigger_than_parent_without_in taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 bde4df2e4..ad4b97bac 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__bo let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__bo .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__co .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_with_inset__co taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 bc079f66f..452212de2 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_left_right_child_bigger_than_parent_without_inset_ taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 c02e4c605..d4b7c1c3c 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_left_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_left_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -149,6 +155,10 @@ fn block_absolute_margin_auto_left_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 569cb85db..c9007cc65 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_left_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_left_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -129,6 +134,7 @@ fn block_absolute_margin_auto_left_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -147,6 +153,10 @@ fn block_absolute_margin_auto_left_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs b/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs index a95c41836..5e77230ac 100644 --- a/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_multiple_children_with_inset.rs @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_multiple_children_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,7 @@ fn block_absolute_margin_auto_multiple_children_with_inset__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -42,6 +44,10 @@ fn block_absolute_margin_auto_multiple_children_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -187,6 +193,7 @@ fn block_absolute_margin_auto_multiple_children_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -205,6 +212,7 @@ fn block_absolute_margin_auto_multiple_children_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -224,6 +232,10 @@ fn block_absolute_margin_auto_multiple_children_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs b/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs index c59916781..bf311f77b 100644 --- a/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs +++ b/tests/generated/block/block_absolute_margin_auto_multiple_children_without_inset.rs @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_multiple_children_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -23,6 +24,7 @@ fn block_absolute_margin_auto_multiple_children_without_inset__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -40,6 +42,10 @@ fn block_absolute_margin_auto_multiple_children_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -185,6 +191,7 @@ fn block_absolute_margin_auto_multiple_children_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +209,7 @@ fn block_absolute_margin_auto_multiple_children_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -220,6 +228,10 @@ fn block_absolute_margin_auto_multiple_children_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 32b3a65de..aa33f970d 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_right_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_right_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -131,6 +136,7 @@ fn block_absolute_margin_auto_right_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -150,6 +156,10 @@ fn block_absolute_margin_auto_right_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 4c7bd2771..3961ba365 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_right_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_right_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_right_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -148,6 +154,10 @@ fn block_absolute_margin_auto_right_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 a92e402be..2e3660866 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_top_with_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn block_absolute_margin_auto_top_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -131,6 +136,7 @@ fn block_absolute_margin_auto_top_with_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -150,6 +156,10 @@ fn block_absolute_margin_auto_top_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 bea17f9dd..933ef2290 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 @@ -7,6 +7,7 @@ fn block_absolute_margin_auto_top_without_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +25,10 @@ fn block_absolute_margin_auto_top_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -130,6 +135,7 @@ fn block_absolute_margin_auto_top_without_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -148,6 +154,10 @@ fn block_absolute_margin_auto_top_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 db85a19f7..3cf283a31 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 @@ -8,6 +8,7 @@ fn block_absolute_margin_bottom_left_with_inset__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +27,10 @@ fn block_absolute_margin_bottom_left_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -132,6 +137,7 @@ fn block_absolute_margin_bottom_left_with_inset__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -151,6 +157,10 @@ fn block_absolute_margin_bottom_left_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 cb72b2b0d..3f70e8f08 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 @@ -8,6 +8,7 @@ fn block_absolute_margin_bottom_left_without_inset__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -20,6 +21,10 @@ fn block_absolute_margin_bottom_left_without_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -126,6 +131,7 @@ fn block_absolute_margin_bottom_left_without_inset__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -139,6 +145,10 @@ fn block_absolute_margin_bottom_left_without_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 0ccf4a80b..941e9e8f1 100644 --- a/tests/generated/block/block_absolute_minmax_bottom_right_max.rs +++ b/tests/generated/block/block_absolute_minmax_bottom_right_max.rs @@ -8,6 +8,7 @@ fn block_absolute_minmax_bottom_right_max__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -24,6 +25,10 @@ fn block_absolute_minmax_bottom_right_max__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -130,6 +135,7 @@ fn block_absolute_minmax_bottom_right_max__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -147,6 +153,10 @@ fn block_absolute_minmax_bottom_right_max__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 4bdbc85d2..6900321df 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 @@ -8,6 +8,7 @@ fn block_absolute_minmax_bottom_right_min_max__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -24,6 +25,10 @@ fn block_absolute_minmax_bottom_right_min_max__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -130,6 +135,7 @@ fn block_absolute_minmax_bottom_right_min_max__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -147,6 +153,10 @@ fn block_absolute_minmax_bottom_right_min_max__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 44e36e133..05dd92afd 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 @@ -8,6 +8,7 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -28,6 +29,10 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -134,6 +139,7 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -155,6 +161,10 @@ fn block_absolute_minmax_bottom_right_min_max_preferred__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 31587651b..80d85e788 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 @@ -8,6 +8,7 @@ fn block_absolute_minmax_top_left_bottom_right_max__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(30f32), @@ -25,6 +26,10 @@ fn block_absolute_minmax_top_left_bottom_right_max__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -131,6 +136,7 @@ fn block_absolute_minmax_top_left_bottom_right_max__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(30f32), @@ -149,6 +155,10 @@ fn block_absolute_minmax_top_left_bottom_right_max__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 aa0fcc024..cefd53511 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 @@ -8,6 +8,7 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -29,6 +30,10 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -135,6 +140,7 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -157,6 +163,10 @@ fn block_absolute_minmax_top_left_bottom_right_min_max__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_absolute_no_styles.rs b/tests/generated/block/block_absolute_no_styles.rs index a4b506a62..4a1de3a94 100644 --- a/tests/generated/block/block_absolute_no_styles.rs +++ b/tests/generated/block/block_absolute_no_styles.rs @@ -7,6 +7,7 @@ fn block_absolute_no_styles__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -18,12 +19,20 @@ fn block_absolute_no_styles__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -162,6 +171,7 @@ fn block_absolute_no_styles__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -174,6 +184,7 @@ fn block_absolute_no_styles__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -182,6 +193,10 @@ fn block_absolute_no_styles__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/block/block_absolute_overflow_clip.rs b/tests/generated/block/block_absolute_overflow_clip.rs index a918b3709..1436acc7e 100644 --- a/tests/generated/block/block_absolute_overflow_clip.rs +++ b/tests/generated/block/block_absolute_overflow_clip.rs @@ -8,6 +8,10 @@ fn block_absolute_overflow_clip__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -28,7 +32,6 @@ fn block_absolute_overflow_clip__border_box() { taffy::style::Style { display: taffy::style::Display::Block, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -153,6 +156,10 @@ fn block_absolute_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -174,7 +181,6 @@ fn block_absolute_overflow_clip__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_absolute_overflow_hidden.rs b/tests/generated/block/block_absolute_overflow_hidden.rs index f91bfd320..93214122c 100644 --- a/tests/generated/block/block_absolute_overflow_hidden.rs +++ b/tests/generated/block/block_absolute_overflow_hidden.rs @@ -8,6 +8,10 @@ fn block_absolute_overflow_hidden__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -156,6 +160,10 @@ fn block_absolute_overflow_hidden__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_absolute_overflow_scroll.rs b/tests/generated/block/block_absolute_overflow_scroll.rs index c4e02eea8..4e7d4adb9 100644 --- a/tests/generated/block/block_absolute_overflow_scroll.rs +++ b/tests/generated/block/block_absolute_overflow_scroll.rs @@ -8,6 +8,10 @@ fn block_absolute_overflow_scroll__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -156,6 +160,10 @@ fn block_absolute_overflow_scroll__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_absolute_overflow_visible.rs b/tests/generated/block/block_absolute_overflow_visible.rs index e95cad842..29d03f6df 100644 --- a/tests/generated/block/block_absolute_overflow_visible.rs +++ b/tests/generated/block/block_absolute_overflow_visible.rs @@ -8,6 +8,10 @@ fn block_absolute_overflow_visible__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -27,6 +31,10 @@ fn block_absolute_overflow_visible__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -151,6 +159,10 @@ fn block_absolute_overflow_visible__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -171,6 +183,10 @@ fn block_absolute_overflow_visible__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), 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 27931f3c4..28a52b129 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 @@ -8,6 +8,7 @@ fn block_absolute_padding_border_overrides_max_size__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -29,7 +30,14 @@ fn block_absolute_padding_border_overrides_max_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -130,6 +138,7 @@ fn block_absolute_padding_border_overrides_max_size__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -154,6 +163,10 @@ fn block_absolute_padding_border_overrides_max_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 115f2ee46..3975f6ee8 100644 --- a/tests/generated/block/block_absolute_padding_border_overrides_size.rs +++ b/tests/generated/block/block_absolute_padding_border_overrides_size.rs @@ -8,6 +8,7 @@ fn block_absolute_padding_border_overrides_size__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -29,7 +30,14 @@ fn block_absolute_padding_border_overrides_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -130,6 +138,7 @@ fn block_absolute_padding_border_overrides_size__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -154,6 +163,10 @@ fn block_absolute_padding_border_overrides_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/block/block_absolute_resolved_insets.rs b/tests/generated/block/block_absolute_resolved_insets.rs index 287e4c3f3..409c3a75a 100644 --- a/tests/generated/block/block_absolute_resolved_insets.rs +++ b/tests/generated/block/block_absolute_resolved_insets.rs @@ -7,6 +7,7 @@ fn block_absolute_resolved_insets__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -19,6 +20,7 @@ fn block_absolute_resolved_insets__border_box() { let node01 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -26,6 +28,7 @@ fn block_absolute_resolved_insets__border_box() { let node02 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -33,6 +36,7 @@ fn block_absolute_resolved_insets__border_box() { let node03 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -40,6 +44,7 @@ fn block_absolute_resolved_insets__border_box() { let node04 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -47,6 +52,7 @@ fn block_absolute_resolved_insets__border_box() { let node05 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -59,6 +65,10 @@ fn block_absolute_resolved_insets__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -83,6 +93,7 @@ fn block_absolute_resolved_insets__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -95,6 +106,7 @@ fn block_absolute_resolved_insets__border_box() { let node11 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -102,6 +114,7 @@ fn block_absolute_resolved_insets__border_box() { let node12 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -109,6 +122,7 @@ fn block_absolute_resolved_insets__border_box() { let node13 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -116,6 +130,7 @@ fn block_absolute_resolved_insets__border_box() { let node14 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -123,6 +138,7 @@ fn block_absolute_resolved_insets__border_box() { let node15 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -164,6 +180,7 @@ fn block_absolute_resolved_insets__border_box() { let node20 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -174,6 +191,7 @@ fn block_absolute_resolved_insets__border_box() { let node21 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -187,6 +205,10 @@ fn block_absolute_resolved_insets__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -208,7 +230,18 @@ fn block_absolute_resolved_insets__border_box() { &[node20, node21], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1, node2]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1, node2], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -965,6 +998,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -978,6 +1012,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -986,6 +1021,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -994,6 +1030,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -1002,6 +1039,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -1010,6 +1048,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -1023,6 +1062,10 @@ fn block_absolute_resolved_insets__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -1048,6 +1091,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -1061,6 +1105,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -1069,6 +1114,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -1077,6 +1123,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -1085,6 +1132,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -1093,6 +1141,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -1136,6 +1185,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -1147,6 +1197,7 @@ fn block_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -1161,6 +1212,10 @@ fn block_absolute_resolved_insets__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -1184,7 +1239,14 @@ fn block_absolute_resolved_insets__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1, node2], ) .unwrap(); diff --git a/tests/generated/block/block_align_baseline_child.rs b/tests/generated/block/block_align_baseline_child.rs index e151689bc..3ca296976 100644 --- a/tests/generated/block/block_align_baseline_child.rs +++ b/tests/generated/block/block_align_baseline_child.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -16,6 +17,7 @@ fn block_align_baseline_child__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,6 +29,10 @@ fn block_align_baseline_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -39,6 +45,10 @@ fn block_align_baseline_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -229,6 +239,7 @@ fn block_align_baseline_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -239,6 +250,7 @@ fn block_align_baseline_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -251,6 +263,10 @@ fn block_align_baseline_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -264,6 +280,10 @@ fn block_align_baseline_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_align_baseline_child_margin.rs b/tests/generated/block/block_align_baseline_child_margin.rs index 8bfb606f9..6fd33639f 100644 --- a/tests/generated/block/block_align_baseline_child_margin.rs +++ b/tests/generated/block/block_align_baseline_child_margin.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -22,6 +23,7 @@ fn block_align_baseline_child_margin__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -39,6 +41,10 @@ fn block_align_baseline_child_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +57,10 @@ fn block_align_baseline_child_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -241,6 +251,7 @@ fn block_align_baseline_child_margin__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -257,6 +268,7 @@ fn block_align_baseline_child_margin__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -275,6 +287,10 @@ fn block_align_baseline_child_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -288,6 +304,10 @@ fn block_align_baseline_child_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 8bb8efdb6..1d62bd4bc 100644 --- a/tests/generated/block/block_align_baseline_child_margin_percent.rs +++ b/tests/generated/block/block_align_baseline_child_margin_percent.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child_margin_percent__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -23,6 +24,7 @@ fn block_align_baseline_child_margin_percent__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -40,6 +42,10 @@ fn block_align_baseline_child_margin_percent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -52,6 +58,10 @@ fn block_align_baseline_child_margin_percent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -242,6 +252,7 @@ fn block_align_baseline_child_margin_percent__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -259,6 +270,7 @@ fn block_align_baseline_child_margin_percent__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -277,6 +289,10 @@ fn block_align_baseline_child_margin_percent__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -290,6 +306,10 @@ fn block_align_baseline_child_margin_percent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_align_baseline_child_padding.rs b/tests/generated/block/block_align_baseline_child_padding.rs index e89a14232..f252681af 100644 --- a/tests/generated/block/block_align_baseline_child_padding.rs +++ b/tests/generated/block/block_align_baseline_child_padding.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child_padding__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn block_align_baseline_child_padding__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn block_align_baseline_child_padding__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -46,6 +52,10 @@ fn block_align_baseline_child_padding__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -242,6 +252,7 @@ fn block_align_baseline_child_padding__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -253,6 +264,7 @@ fn block_align_baseline_child_padding__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -265,6 +277,10 @@ fn block_align_baseline_child_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -284,6 +300,10 @@ fn block_align_baseline_child_padding__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_align_baseline_child_top.rs b/tests/generated/block/block_align_baseline_child_top.rs index 7edcd7c77..dcbad2da2 100644 --- a/tests/generated/block/block_align_baseline_child_top.rs +++ b/tests/generated/block/block_align_baseline_child_top.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child_top__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,7 @@ fn block_align_baseline_child_top__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -29,6 +31,10 @@ fn block_align_baseline_child_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -41,6 +47,10 @@ fn block_align_baseline_child_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -231,6 +241,7 @@ fn block_align_baseline_child_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -243,6 +254,7 @@ fn block_align_baseline_child_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -255,6 +267,10 @@ fn block_align_baseline_child_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -268,6 +284,10 @@ fn block_align_baseline_child_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_align_baseline_child_top2.rs b/tests/generated/block/block_align_baseline_child_top2.rs index 65a5f9f8c..9ec84f318 100644 --- a/tests/generated/block/block_align_baseline_child_top2.rs +++ b/tests/generated/block/block_align_baseline_child_top2.rs @@ -7,6 +7,7 @@ fn block_align_baseline_child_top2__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn block_align_baseline_child_top2__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn block_align_baseline_child_top2__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -41,6 +47,10 @@ fn block_align_baseline_child_top2__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -231,6 +241,7 @@ fn block_align_baseline_child_top2__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -242,6 +253,7 @@ fn block_align_baseline_child_top2__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -254,6 +266,10 @@ fn block_align_baseline_child_top2__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -268,6 +284,10 @@ fn block_align_baseline_child_top2__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 cc78903fa..c7a7d5824 100644 --- a/tests/generated/block/block_align_baseline_double_nested_child.rs +++ b/tests/generated/block/block_align_baseline_double_nested_child.rs @@ -7,6 +7,7 @@ fn block_align_baseline_double_nested_child__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn block_align_baseline_double_nested_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -30,6 +35,7 @@ fn block_align_baseline_double_nested_child__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -41,6 +47,10 @@ fn block_align_baseline_double_nested_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -53,6 +63,10 @@ fn block_align_baseline_double_nested_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -288,6 +302,7 @@ fn block_align_baseline_double_nested_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -300,6 +315,10 @@ fn block_align_baseline_double_nested_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -313,6 +332,7 @@ fn block_align_baseline_double_nested_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -325,6 +345,10 @@ fn block_align_baseline_double_nested_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -338,6 +362,10 @@ fn block_align_baseline_double_nested_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_aspect_ratio_fill_height.rs b/tests/generated/block/block_aspect_ratio_fill_height.rs index e76fabf0d..8d5ad200c 100644 --- a/tests/generated/block/block_aspect_ratio_fill_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_height.rs @@ -7,6 +7,7 @@ fn block_aspect_ratio_fill_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn block_aspect_ratio_fill_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn block_aspect_ratio_fill_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn block_aspect_ratio_fill_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 cc0d01d29..af269b5a6 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_height.rs @@ -10,6 +10,10 @@ fn block_aspect_ratio_fill_max_height__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -21,6 +25,10 @@ fn block_aspect_ratio_fill_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -129,6 +137,10 @@ fn block_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -141,6 +153,10 @@ fn block_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 cd83028e0..df3cc6f42 100644 --- a/tests/generated/block/block_aspect_ratio_fill_max_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_max_width.rs @@ -8,6 +8,10 @@ fn block_aspect_ratio_fill_max_width__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -19,6 +23,10 @@ fn block_aspect_ratio_fill_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +133,10 @@ fn block_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -137,6 +149,10 @@ fn block_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 a3924ffee..3722f7f6e 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_height.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_height.rs @@ -7,6 +7,7 @@ fn block_aspect_ratio_fill_min_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn block_aspect_ratio_fill_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn block_aspect_ratio_fill_min_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn block_aspect_ratio_fill_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 99c7943d4..3d4b72ec2 100644 --- a/tests/generated/block/block_aspect_ratio_fill_min_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_min_width.rs @@ -8,6 +8,10 @@ fn block_aspect_ratio_fill_min_width__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -19,6 +23,10 @@ fn block_aspect_ratio_fill_min_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +133,10 @@ fn block_aspect_ratio_fill_min_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -137,6 +149,10 @@ fn block_aspect_ratio_fill_min_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_aspect_ratio_fill_width.rs b/tests/generated/block/block_aspect_ratio_fill_width.rs index 20ca9367a..a02d97998 100644 --- a/tests/generated/block/block_aspect_ratio_fill_width.rs +++ b/tests/generated/block/block_aspect_ratio_fill_width.rs @@ -7,6 +7,7 @@ fn block_aspect_ratio_fill_width__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn block_aspect_ratio_fill_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn block_aspect_ratio_fill_width__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn block_aspect_ratio_fill_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_basic.rs b/tests/generated/block/block_basic.rs index 7cb4455f8..5498a9ce0 100644 --- a/tests/generated/block/block_basic.rs +++ b/tests/generated/block/block_basic.rs @@ -6,12 +6,14 @@ fn block_basic__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -20,6 +22,10 @@ fn block_basic__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -160,6 +166,7 @@ fn block_basic__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -167,6 +174,7 @@ fn block_basic__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -176,6 +184,10 @@ fn block_basic__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_border_fixed_size.rs b/tests/generated/block/block_border_fixed_size.rs index 4fdc761a7..d750865c9 100644 --- a/tests/generated/block/block_border_fixed_size.rs +++ b/tests/generated/block/block_border_fixed_size.rs @@ -6,12 +6,14 @@ fn block_border_fixed_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -20,6 +22,10 @@ fn block_border_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -169,6 +175,7 @@ fn block_border_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -176,6 +183,7 @@ fn block_border_fixed_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -185,6 +193,10 @@ fn block_border_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_border_intrinsic_size.rs b/tests/generated/block/block_border_intrinsic_size.rs index c50ee3fbc..96a939754 100644 --- a/tests/generated/block/block_border_intrinsic_size.rs +++ b/tests/generated/block/block_border_intrinsic_size.rs @@ -6,6 +6,7 @@ fn block_border_intrinsic_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn block_border_intrinsic_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -23,6 +25,10 @@ fn block_border_intrinsic_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(8f32), right: length(4f32), @@ -168,6 +174,7 @@ fn block_border_intrinsic_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -178,6 +185,7 @@ fn block_border_intrinsic_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -187,6 +195,10 @@ fn block_border_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(8f32), right: length(4f32), diff --git a/tests/generated/block/block_border_percentage_fixed_size.rs b/tests/generated/block/block_border_percentage_fixed_size.rs index 1e4740dab..395d98c6b 100644 --- a/tests/generated/block/block_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_border_percentage_fixed_size.rs @@ -7,13 +7,21 @@ fn block_border_percentage_fixed_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -21,6 +29,10 @@ fn block_border_percentage_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -171,6 +183,7 @@ fn block_border_percentage_fixed_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -180,6 +193,10 @@ fn block_border_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -190,6 +207,10 @@ fn block_border_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_border_percentage_intrinsic_size.rs b/tests/generated/block/block_border_percentage_intrinsic_size.rs index 9825c04cf..2237804a7 100644 --- a/tests/generated/block/block_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_border_percentage_intrinsic_size.rs @@ -7,19 +7,34 @@ fn block_border_percentage_intrinsic_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -164,6 +179,7 @@ fn block_border_percentage_intrinsic_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -173,6 +189,10 @@ fn block_border_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -183,6 +203,10 @@ fn block_border_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/block/block_display_none.rs b/tests/generated/block/block_display_none.rs index 58454958c..399b93423 100644 --- a/tests/generated/block/block_display_none.rs +++ b/tests/generated/block/block_display_none.rs @@ -6,6 +6,7 @@ fn block_display_none__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -13,12 +14,14 @@ fn block_display_none__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -27,6 +30,10 @@ fn block_display_none__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -206,6 +213,7 @@ fn block_display_none__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -214,6 +222,7 @@ fn block_display_none__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -221,6 +230,7 @@ fn block_display_none__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -230,6 +240,10 @@ fn block_display_none__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_display_none_with_child.rs b/tests/generated/block/block_display_none_with_child.rs index b5fc73427..5b9d247b2 100644 --- a/tests/generated/block/block_display_none_with_child.rs +++ b/tests/generated/block/block_display_none_with_child.rs @@ -6,12 +6,14 @@ fn block_display_none_with_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,12 +23,20 @@ fn block_display_none_with_child__border_box() { .unwrap(); let node1 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::None, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::None, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node10], ) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -35,6 +45,10 @@ fn block_display_none_with_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -256,6 +270,7 @@ fn block_display_none_with_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -263,6 +278,7 @@ fn block_display_none_with_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -275,6 +291,10 @@ fn block_display_none_with_child__content_box() { taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node10], @@ -283,6 +303,7 @@ fn block_display_none_with_child__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -292,6 +313,10 @@ fn block_display_none_with_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_display_none_with_inset.rs b/tests/generated/block/block_display_none_with_inset.rs index 4b7bfda2e..9e87b017b 100644 --- a/tests/generated/block/block_display_none_with_inset.rs +++ b/tests/generated/block/block_display_none_with_inset.rs @@ -6,6 +6,7 @@ fn block_display_none_with_inset__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -13,6 +14,7 @@ fn block_display_none_with_inset__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(10f32), bottom: auto() }, ..Default::default() @@ -22,6 +24,10 @@ fn block_display_none_with_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -165,6 +171,7 @@ fn block_display_none_with_inset__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -173,6 +180,7 @@ fn block_display_none_with_inset__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(10f32), bottom: auto() }, ..Default::default() @@ -183,6 +191,10 @@ fn block_display_none_with_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_display_none_with_margin.rs b/tests/generated/block/block_display_none_with_margin.rs index e43b15ca9..1eda2d43f 100644 --- a/tests/generated/block/block_display_none_with_margin.rs +++ b/tests/generated/block/block_display_none_with_margin.rs @@ -7,6 +7,7 @@ fn block_display_none_with_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -22,6 +23,7 @@ fn block_display_none_with_margin__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -30,6 +32,10 @@ fn block_display_none_with_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -174,6 +180,7 @@ fn block_display_none_with_margin__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -190,6 +197,7 @@ fn block_display_none_with_margin__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -199,6 +207,10 @@ fn block_display_none_with_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 85dcb3ddc..a5c635029 100644 --- a/tests/generated/block/block_display_none_with_position_absolute.rs +++ b/tests/generated/block/block_display_none_with_position_absolute.rs @@ -8,6 +8,7 @@ fn block_display_none_with_position_absolute__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -19,6 +20,10 @@ fn block_display_none_with_position_absolute__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn block_display_none_with_position_absolute__content_box() { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -137,6 +143,10 @@ fn block_display_none_with_position_absolute__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_inflow_overflow_clip.rs b/tests/generated/block/block_inflow_overflow_clip.rs index 637c97c56..b6a4fcc36 100644 --- a/tests/generated/block/block_inflow_overflow_clip.rs +++ b/tests/generated/block/block_inflow_overflow_clip.rs @@ -7,6 +7,10 @@ fn block_inflow_overflow_clip__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -21,7 +25,6 @@ fn block_inflow_overflow_clip__border_box() { taffy::style::Style { display: taffy::style::Display::Block, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -145,6 +148,10 @@ fn block_inflow_overflow_clip__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -160,7 +167,6 @@ fn block_inflow_overflow_clip__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_inflow_overflow_hidden.rs b/tests/generated/block/block_inflow_overflow_hidden.rs index f5879ea83..df1ebc8f3 100644 --- a/tests/generated/block/block_inflow_overflow_hidden.rs +++ b/tests/generated/block/block_inflow_overflow_hidden.rs @@ -7,6 +7,10 @@ fn block_inflow_overflow_hidden__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -148,6 +152,10 @@ fn block_inflow_overflow_hidden__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_inflow_overflow_scroll.rs b/tests/generated/block/block_inflow_overflow_scroll.rs index 01249c865..f0046a795 100644 --- a/tests/generated/block/block_inflow_overflow_scroll.rs +++ b/tests/generated/block/block_inflow_overflow_scroll.rs @@ -7,6 +7,10 @@ fn block_inflow_overflow_scroll__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -148,6 +152,10 @@ fn block_inflow_overflow_scroll__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_inflow_overflow_visible.rs b/tests/generated/block/block_inflow_overflow_visible.rs index a670e31cf..e4f48a276 100644 --- a/tests/generated/block/block_inflow_overflow_visible.rs +++ b/tests/generated/block/block_inflow_overflow_visible.rs @@ -7,6 +7,10 @@ fn block_inflow_overflow_visible__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -20,6 +24,10 @@ fn block_inflow_overflow_visible__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -143,6 +151,10 @@ fn block_inflow_overflow_visible__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -157,6 +169,10 @@ fn block_inflow_overflow_visible__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_inset_fixed.rs b/tests/generated/block/block_inset_fixed.rs index c74c592a0..1af9b4938 100644 --- a/tests/generated/block/block_inset_fixed.rs +++ b/tests/generated/block/block_inset_fixed.rs @@ -6,6 +6,7 @@ fn block_inset_fixed__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: length(2f32), right: auto(), top: length(4f32), bottom: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_inset_fixed__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: length(6f32), top: auto(), bottom: length(8f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_inset_fixed__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: length(2f32), @@ -34,6 +37,10 @@ fn block_inset_fixed__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -213,6 +220,7 @@ fn block_inset_fixed__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: length(2f32), right: auto(), top: length(4f32), bottom: auto() }, ..Default::default() @@ -221,6 +229,7 @@ fn block_inset_fixed__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: length(6f32), top: auto(), bottom: length(8f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn block_inset_fixed__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: length(2f32), @@ -244,6 +254,10 @@ fn block_inset_fixed__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_inset_percentage.rs b/tests/generated/block/block_inset_percentage.rs index 1f1bddc86..2a267329a 100644 --- a/tests/generated/block/block_inset_percentage.rs +++ b/tests/generated/block/block_inset_percentage.rs @@ -6,6 +6,7 @@ fn block_inset_percentage__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: percent(0.02f32), @@ -18,6 +19,7 @@ fn block_inset_percentage__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), @@ -30,6 +32,7 @@ fn block_inset_percentage__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: percent(0.02f32), @@ -44,6 +47,10 @@ fn block_inset_percentage__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -223,6 +230,7 @@ fn block_inset_percentage__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: percent(0.02f32), @@ -236,6 +244,7 @@ fn block_inset_percentage__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), @@ -249,6 +258,7 @@ fn block_inset_percentage__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: percent(0.02f32), @@ -264,6 +274,10 @@ fn block_inset_percentage__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_intrinsic_width.rs b/tests/generated/block/block_intrinsic_width.rs index afc36cbe4..a2d0ea7ca 100644 --- a/tests/generated/block/block_intrinsic_width.rs +++ b/tests/generated/block/block_intrinsic_width.rs @@ -6,6 +6,7 @@ fn block_intrinsic_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,13 +16,21 @@ fn block_intrinsic_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -159,6 +168,7 @@ fn block_intrinsic_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -169,6 +179,7 @@ fn block_intrinsic_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -178,6 +189,10 @@ fn block_intrinsic_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/block/block_item_max_width.rs b/tests/generated/block/block_item_max_width.rs index 7baba66a3..c28d0161f 100644 --- a/tests/generated/block/block_item_max_width.rs +++ b/tests/generated/block/block_item_max_width.rs @@ -6,6 +6,7 @@ fn block_item_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_item_max_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -22,6 +24,10 @@ fn block_item_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -165,6 +171,7 @@ fn block_item_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -173,6 +180,7 @@ fn block_item_max_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -183,6 +191,10 @@ fn block_item_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_item_min_width_overrides_max_width.rs b/tests/generated/block/block_item_min_width_overrides_max_width.rs index 88b5e5929..772b54838 100644 --- a/tests/generated/block/block_item_min_width_overrides_max_width.rs +++ b/tests/generated/block/block_item_min_width_overrides_max_width.rs @@ -6,6 +6,7 @@ fn block_item_min_width_overrides_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, @@ -16,6 +17,10 @@ fn block_item_min_width_overrides_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn block_item_min_width_overrides_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, @@ -131,6 +137,10 @@ fn block_item_min_width_overrides_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/block/block_item_text_align_center.rs b/tests/generated/block/block_item_text_align_center.rs index 5da66b6c4..6bef04a91 100644 --- a/tests/generated/block/block_item_text_align_center.rs +++ b/tests/generated/block/block_item_text_align_center.rs @@ -6,6 +6,7 @@ fn block_item_text_align_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_item_text_align_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -23,6 +25,10 @@ fn block_item_text_align_center__border_box() { taffy::style::Style { display: taffy::style::Display::Block, text_align: taffy::style::TextAlign::LegacyCenter, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -166,6 +172,7 @@ fn block_item_text_align_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -174,6 +181,7 @@ fn block_item_text_align_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -185,6 +193,10 @@ fn block_item_text_align_center__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, text_align: taffy::style::TextAlign::LegacyCenter, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_item_text_align_left.rs b/tests/generated/block/block_item_text_align_left.rs index 7f37caba8..6b036c42b 100644 --- a/tests/generated/block/block_item_text_align_left.rs +++ b/tests/generated/block/block_item_text_align_left.rs @@ -6,6 +6,7 @@ fn block_item_text_align_left__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_item_text_align_left__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -23,6 +25,10 @@ fn block_item_text_align_left__border_box() { taffy::style::Style { display: taffy::style::Display::Block, text_align: taffy::style::TextAlign::LegacyLeft, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -166,6 +172,7 @@ fn block_item_text_align_left__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -174,6 +181,7 @@ fn block_item_text_align_left__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -185,6 +193,10 @@ fn block_item_text_align_left__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, text_align: taffy::style::TextAlign::LegacyLeft, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_item_text_align_right.rs b/tests/generated/block/block_item_text_align_right.rs index 5b388de5c..db4ffcaaf 100644 --- a/tests/generated/block/block_item_text_align_right.rs +++ b/tests/generated/block/block_item_text_align_right.rs @@ -6,6 +6,7 @@ fn block_item_text_align_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_item_text_align_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -23,6 +25,10 @@ fn block_item_text_align_right__border_box() { taffy::style::Style { display: taffy::style::Display::Block, text_align: taffy::style::TextAlign::LegacyRight, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -166,6 +172,7 @@ fn block_item_text_align_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -174,6 +181,7 @@ fn block_item_text_align_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -185,6 +193,10 @@ fn block_item_text_align_right__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, text_align: taffy::style::TextAlign::LegacyRight, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_margin_auto_bottom.rs b/tests/generated/block/block_margin_auto_bottom.rs index 2186c3b8a..46d738232 100644 --- a/tests/generated/block/block_margin_auto_bottom.rs +++ b/tests/generated/block/block_margin_auto_bottom.rs @@ -6,6 +6,7 @@ fn block_margin_auto_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_bottom__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -176,6 +182,7 @@ fn block_margin_auto_bottom__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -192,6 +199,7 @@ fn block_margin_auto_bottom__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -204,6 +212,10 @@ fn block_margin_auto_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 156aea55c..eeb31bf7d 100644 --- a/tests/generated/block/block_margin_auto_bottom_and_top.rs +++ b/tests/generated/block/block_margin_auto_bottom_and_top.rs @@ -6,6 +6,7 @@ fn block_margin_auto_bottom_and_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_bottom_and_top__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_bottom_and_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn block_margin_auto_bottom_and_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn block_margin_auto_bottom_and_top__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -203,6 +211,10 @@ fn block_margin_auto_bottom_and_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_margin_auto_left.rs b/tests/generated/block/block_margin_auto_left.rs index 41cafd946..39791459b 100644 --- a/tests/generated/block/block_margin_auto_left.rs +++ b/tests/generated/block/block_margin_auto_left.rs @@ -6,6 +6,7 @@ fn block_margin_auto_left__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_left__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_left__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn block_margin_auto_left__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn block_margin_auto_left__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -203,6 +211,10 @@ fn block_margin_auto_left__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 6d3453196..b29c6fa1d 100644 --- a/tests/generated/block/block_margin_auto_left_and_right.rs +++ b/tests/generated/block/block_margin_auto_left_and_right.rs @@ -6,6 +6,7 @@ fn block_margin_auto_left_and_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_left_and_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_left_and_right__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn block_margin_auto_left_and_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn block_margin_auto_left_and_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -203,6 +211,10 @@ fn block_margin_auto_left_and_right__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs b/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs index f81068851..19ca1991f 100644 --- a/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs +++ b/tests/generated/block/block_margin_auto_left_and_right_with_auto_width.rs @@ -7,6 +7,10 @@ fn block_margin_auto_left_and_right_with_auto_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::AUTO, height: taffy::style::Dimension::from_length(50f32), @@ -27,6 +31,10 @@ fn block_margin_auto_left_and_right_with_auto_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -132,6 +140,10 @@ fn block_margin_auto_left_and_right_with_auto_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::AUTO, height: taffy::style::Dimension::from_length(50f32), @@ -153,6 +165,10 @@ fn block_margin_auto_left_and_right_with_auto_width__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 2f4f4ed0a..540840163 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 @@ -6,6 +6,7 @@ fn block_margin_auto_left_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -23,6 +24,10 @@ fn block_margin_auto_left_child_bigger_than_parent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn block_margin_auto_left_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -145,6 +151,10 @@ fn block_margin_auto_left_child_bigger_than_parent__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 66c4fc1e2..3813162e9 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 @@ -6,6 +6,7 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -23,6 +24,10 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -145,6 +151,10 @@ fn block_margin_auto_left_fix_right_child_bigger_than_parent__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), 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 2e8067b07..81d264629 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 @@ -6,6 +6,7 @@ fn block_margin_auto_left_right_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -23,6 +24,10 @@ fn block_margin_auto_left_right_child_bigger_than_parent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn block_margin_auto_left_right_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -145,6 +151,10 @@ fn block_margin_auto_left_right_child_bigger_than_parent__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), diff --git a/tests/generated/block/block_margin_auto_multiple_children.rs b/tests/generated/block/block_margin_auto_multiple_children.rs index 977d6e141..a533cf5e6 100644 --- a/tests/generated/block/block_margin_auto_multiple_children.rs +++ b/tests/generated/block/block_margin_auto_multiple_children.rs @@ -6,6 +6,7 @@ fn block_margin_auto_multiple_children__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_multiple_children__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -36,6 +38,7 @@ fn block_margin_auto_multiple_children__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -47,6 +50,10 @@ fn block_margin_auto_multiple_children__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -230,6 +237,7 @@ fn block_margin_auto_multiple_children__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -246,6 +254,7 @@ fn block_margin_auto_multiple_children__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -262,6 +271,7 @@ fn block_margin_auto_multiple_children__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -274,6 +284,10 @@ fn block_margin_auto_multiple_children__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_margin_auto_right.rs b/tests/generated/block/block_margin_auto_right.rs index 6fb0baa05..4d4f40b81 100644 --- a/tests/generated/block/block_margin_auto_right.rs +++ b/tests/generated/block/block_margin_auto_right.rs @@ -6,6 +6,7 @@ fn block_margin_auto_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_right__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -176,6 +182,7 @@ fn block_margin_auto_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -192,6 +199,7 @@ fn block_margin_auto_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -204,6 +212,10 @@ fn block_margin_auto_right__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/block/block_margin_auto_top.rs b/tests/generated/block/block_margin_auto_top.rs index ec4e734b3..272885b3b 100644 --- a/tests/generated/block/block_margin_auto_top.rs +++ b/tests/generated/block/block_margin_auto_top.rs @@ -6,6 +6,7 @@ fn block_margin_auto_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn block_margin_auto_top__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn block_margin_auto_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -176,6 +182,7 @@ fn block_margin_auto_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -192,6 +199,7 @@ fn block_margin_auto_top__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -204,6 +212,10 @@ fn block_margin_auto_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 07b161088..1591d1d10 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_bottom.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_bottom.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_auto_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_x_fixed_auto_bottom__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_x_fixed_auto_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_x_fixed_auto_bottom__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_x_fixed_auto_bottom__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_x_fixed_auto_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 5b674da3d..0a6fcc960 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_left.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_left.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_auto_left__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_x_fixed_auto_left__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_x_fixed_auto_left__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_x_fixed_auto_left__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_x_fixed_auto_left__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_x_fixed_auto_left__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 6d4077612..3e4b03631 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 @@ -6,6 +6,7 @@ fn block_margin_x_fixed_auto_left_and_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_x_fixed_auto_left_and_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_x_fixed_auto_left_and_right__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_x_fixed_auto_left_and_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_x_fixed_auto_left_and_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_x_fixed_auto_left_and_right__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 1512b9b8c..2244e7588 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_right.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_right.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_auto_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_x_fixed_auto_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_x_fixed_auto_right__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_x_fixed_auto_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_x_fixed_auto_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_x_fixed_auto_right__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9d8687202..b00efe4e6 100644 --- a/tests/generated/block/block_margin_x_fixed_auto_top.rs +++ b/tests/generated/block/block_margin_x_fixed_auto_top.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_auto_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_x_fixed_auto_top__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_x_fixed_auto_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_x_fixed_auto_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_x_fixed_auto_top__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_x_fixed_auto_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 4bc8059d2..eea43b878 100644 --- a/tests/generated/block/block_margin_x_fixed_size_negative.rs +++ b/tests/generated/block/block_margin_x_fixed_size_negative.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_size_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(-10f32), right: length(-5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_x_fixed_size_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn block_margin_x_fixed_size_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -161,6 +167,7 @@ fn block_margin_x_fixed_size_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(-10f32), right: length(-5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -169,6 +176,7 @@ fn block_margin_x_fixed_size_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -178,6 +186,10 @@ fn block_margin_x_fixed_size_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 47b5d87c2..a50d54eee 100644 --- a/tests/generated/block/block_margin_x_fixed_size_positive.rs +++ b/tests/generated/block/block_margin_x_fixed_size_positive.rs @@ -6,6 +6,7 @@ fn block_margin_x_fixed_size_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(10f32), right: length(5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_x_fixed_size_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn block_margin_x_fixed_size_positive__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -161,6 +167,7 @@ fn block_margin_x_fixed_size_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(10f32), right: length(5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -169,6 +176,7 @@ fn block_margin_x_fixed_size_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -178,6 +186,10 @@ fn block_margin_x_fixed_size_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 24bcba523..69cc2e349 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_negative.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_negative.rs @@ -6,6 +6,7 @@ fn block_margin_x_intrinsic_size_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(-10f32), right: length(-5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -13,13 +14,21 @@ fn block_margin_x_intrinsic_size_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -157,6 +166,7 @@ fn block_margin_x_intrinsic_size_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(-10f32), right: length(-5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -165,6 +175,7 @@ fn block_margin_x_intrinsic_size_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -174,6 +185,10 @@ fn block_margin_x_intrinsic_size_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 0fcd34124..86d355c8e 100644 --- a/tests/generated/block/block_margin_x_intrinsic_size_positive.rs +++ b/tests/generated/block/block_margin_x_intrinsic_size_positive.rs @@ -6,6 +6,7 @@ fn block_margin_x_intrinsic_size_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(10f32), right: length(5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -13,13 +14,21 @@ fn block_margin_x_intrinsic_size_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -157,6 +166,7 @@ fn block_margin_x_intrinsic_size_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: length(10f32), right: length(5f32), top: zero(), bottom: zero() }, ..Default::default() @@ -165,6 +175,7 @@ fn block_margin_x_intrinsic_size_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -174,6 +185,10 @@ fn block_margin_x_intrinsic_size_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 f9e893c2e..a57ed8c15 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_fixed_size_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(-0.2f32), @@ -18,6 +19,7 @@ fn block_margin_x_percentage_fixed_size_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +28,10 @@ fn block_margin_x_percentage_fixed_size_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -166,6 +172,7 @@ fn block_margin_x_percentage_fixed_size_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(-0.2f32), @@ -179,6 +186,7 @@ fn block_margin_x_percentage_fixed_size_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -188,6 +196,10 @@ fn block_margin_x_percentage_fixed_size_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 6ece45293..5b64830a9 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_fixed_size_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -18,6 +19,7 @@ fn block_margin_x_percentage_fixed_size_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +28,10 @@ fn block_margin_x_percentage_fixed_size_positive__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -166,6 +172,7 @@ fn block_margin_x_percentage_fixed_size_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -179,6 +186,7 @@ fn block_margin_x_percentage_fixed_size_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -188,6 +196,10 @@ fn block_margin_x_percentage_fixed_size_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 06ba51eea..63e76a2fb 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(-0.2f32), @@ -18,6 +19,7 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,7 +29,14 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -165,6 +174,7 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(-0.2f32), @@ -178,6 +188,7 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -190,6 +201,10 @@ fn block_margin_x_percentage_intrinsic_size_other_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 00329c3f8..1281f1259 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -18,6 +19,7 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,7 +29,14 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -165,6 +174,7 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -178,6 +188,7 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -190,6 +201,10 @@ fn block_margin_x_percentage_intrinsic_size_other_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 e8e58aea8..d767b8a18 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,7 +22,14 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -120,6 +128,7 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -138,6 +147,10 @@ fn block_margin_x_percentage_intrinsic_size_self_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 392d6a4d9..e0c0d9c68 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 @@ -6,6 +6,7 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,7 +22,14 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -120,6 +128,7 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -138,6 +147,10 @@ fn block_margin_x_percentage_intrinsic_size_self_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/block/block_margin_y_collapse_complex.rs b/tests/generated/block/block_margin_y_collapse_complex.rs index b7c73bef4..c2ffd7eb6 100644 --- a/tests/generated/block/block_margin_y_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_collapse_complex.rs @@ -6,6 +6,7 @@ fn block_margin_y_collapse_complex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_collapse_complex__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_margin_y_collapse_complex__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: length(3f32) }, ..Default::default() @@ -27,6 +30,7 @@ fn block_margin_y_collapse_complex__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-6f32), bottom: length(9f32) }, ..Default::default() @@ -35,6 +39,10 @@ fn block_margin_y_collapse_complex__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -49,6 +57,7 @@ fn block_margin_y_collapse_complex__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -56,6 +65,7 @@ fn block_margin_y_collapse_complex__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -65,6 +75,10 @@ fn block_margin_y_collapse_complex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -418,6 +432,7 @@ fn block_margin_y_collapse_complex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -426,6 +441,7 @@ fn block_margin_y_collapse_complex__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -434,6 +450,7 @@ fn block_margin_y_collapse_complex__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: length(3f32) }, ..Default::default() @@ -442,6 +459,7 @@ fn block_margin_y_collapse_complex__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-6f32), bottom: length(9f32) }, ..Default::default() @@ -451,6 +469,10 @@ fn block_margin_y_collapse_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -466,6 +488,7 @@ fn block_margin_y_collapse_complex__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -474,6 +497,7 @@ fn block_margin_y_collapse_complex__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -484,6 +508,10 @@ fn block_margin_y_collapse_complex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 3a8be004e..13e9938be 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(2f32), margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -23,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -32,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -212,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -221,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(2f32), margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -230,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -240,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_aspect_ratio__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 ae9c1c839..63bc20b46 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn block_margin_y_collapse_through_blocked_by_border_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9c834d441..f00584fa5 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_collapse_through_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn block_margin_y_collapse_through_blocked_by_border_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn block_margin_y_collapse_through_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7458bbf8b..8ffe9b973 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_height__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -23,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_height__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -32,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -212,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -221,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -230,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -240,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7f61d3d9d..4e20d1363 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), @@ -30,6 +35,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -39,6 +45,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -219,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -229,6 +240,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), @@ -244,6 +259,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -254,6 +270,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 84b2eee09..9fb9289aa 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__border_ let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__border_ .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -31,6 +36,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__border_ let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -40,6 +46,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__border_ .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -220,6 +230,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__content .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -230,6 +241,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__content taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -246,6 +261,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__content .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -256,6 +272,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_height_zero__content taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 2881792da..a1c96066b 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__bor let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__bor .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -31,6 +36,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__bor let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -40,6 +46,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__bor .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -220,6 +230,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__con .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -230,6 +241,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__con taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -246,6 +261,7 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__con .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -256,6 +272,10 @@ fn block_margin_y_collapse_through_blocked_by_line_box_with_max_height_zero__con taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 a5a8cdd07..7469e9c40 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -23,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -32,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -212,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -221,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -230,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_min_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -240,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 f34947662..ee51ac51f 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -24,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -33,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -213,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -232,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -242,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7d21ef7a9..558d127af 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -24,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -33,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -213,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -232,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -242,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_x_scroll__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 84db733a6..30bc3d9cd 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -24,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -33,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -213,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -232,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -242,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7268a8c84..93f960755 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -24,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -33,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -213,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -232,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -242,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_overflow_y_scroll__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 f1839fbb2..e5182fa20 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -23,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -32,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -212,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -221,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -230,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -240,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_padding_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 f7fe5662d..f6306a43e 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -23,6 +25,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -32,6 +35,10 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -212,6 +219,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -221,6 +229,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -230,6 +239,7 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -240,6 +250,10 @@ fn block_margin_y_collapse_through_blocked_by_padding_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 092970bb5..75a6b1491 100644 --- a/tests/generated/block/block_margin_y_collapse_through_negative.rs +++ b/tests/generated/block/block_margin_y_collapse_through_negative.rs @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_negative__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_negative__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-7f32), bottom: length(-3f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_collapse_through_negative__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-2f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_collapse_through_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn block_margin_y_collapse_through_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn block_margin_y_collapse_through_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-7f32), bottom: length(-3f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn block_margin_y_collapse_through_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-2f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn block_margin_y_collapse_through_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 65647b883..41bcbd00a 100644 --- a/tests/generated/block/block_margin_y_collapse_through_positive.rs +++ b/tests/generated/block/block_margin_y_collapse_through_positive.rs @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_positive__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_positive__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_collapse_through_positive__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_collapse_through_positive__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn block_margin_y_collapse_through_positive__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn block_margin_y_collapse_through_positive__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn block_margin_y_collapse_through_positive__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn block_margin_y_collapse_through_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 e6cd4f3ad..4543276bf 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_positive_and_negative__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_collapse_through_positive_and_negative__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(-4f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_collapse_through_positive_and_negative__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_collapse_through_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn block_margin_y_collapse_through_positive_and_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn block_margin_y_collapse_through_positive_and_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(-4f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn block_margin_y_collapse_through_positive_and_negative__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn block_margin_y_collapse_through_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 5dd8afa37..79899c6d9 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 @@ -7,6 +7,7 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -14,7 +15,14 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { .unwrap(); let node10 = taffy .new_leaf_with_context( - taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }, + taffy::style::Style { + position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -22,6 +30,10 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), @@ -36,6 +48,7 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -45,6 +58,10 @@ fn block_margin_y_collapse_through_with_absolute_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -270,6 +287,7 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -280,6 +298,10 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), @@ -290,6 +312,10 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), @@ -305,6 +331,7 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -315,6 +342,10 @@ fn block_margin_y_collapse_through_with_absolute_child__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 0b9bb286a..f85be50f3 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 91ec8caa7..9b2634720 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__border_box( let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__content_box let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_hidden__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7bb44bc4f..55139cb6f 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__border_box( let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__content_box let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_x_scroll__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 52878665c..51ea7f4c1 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__border_box( let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__content_box let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_hidden__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 059e7d6a0..c3fc49c40 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__border_box( let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__content_box let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_first_child_collapse_blocked_by_overflow_y_scroll__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 4f31b9de1..c323acd75 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -35,6 +44,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -226,6 +239,7 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -235,6 +249,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -246,6 +264,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -258,6 +280,10 @@ fn block_margin_y_first_child_collapse_blocked_by_padding_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 651763b77..be665c05b 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_negative_equal__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_negative_equal__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 c71370180..b35e8e98d 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9e9263a55..9fed4f324 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 33def4e59..246687850 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__border_box( let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__content_box let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_border_bottom__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7758fb4b5..01190929d 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__border_box let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__border_box .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__border_box .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -35,6 +44,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__border_box .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -226,6 +239,7 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__content_bo let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -235,6 +249,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__content_bo taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -246,6 +264,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__content_bo taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -258,6 +280,10 @@ fn block_margin_y_first_child_collapse_not_blocked_by_padding_bottom__content_bo taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 ee0d19cb7..2828ccb69 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -32,6 +41,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .unwrap(); let node100 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -40,6 +50,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -50,6 +64,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -58,6 +76,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .unwrap(); let node200 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -66,6 +85,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -76,6 +99,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -86,6 +113,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -535,6 +566,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -544,6 +576,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -555,6 +591,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -564,6 +604,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { let node100 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -573,6 +614,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -584,6 +629,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -593,6 +642,7 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { let node200 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -602,6 +652,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -613,6 +667,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: zero() }, ..Default::default() }, @@ -624,6 +682,10 @@ fn block_margin_y_first_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 d89c8bca0..19e31c0a5 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_positive_equal__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_positive_equal__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 0d19b8965..fff1a5943 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 f20112def..92e54ebed 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_first_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 0ff809734..ca2c8f5c6 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -42,6 +55,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .unwrap(); let node1000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -50,6 +64,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-2f32), bottom: zero() }, ..Default::default() }, @@ -60,6 +78,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -70,6 +92,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -78,6 +104,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .unwrap(); let node2000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -86,6 +113,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(15f32), bottom: zero() }, ..Default::default() }, @@ -96,6 +127,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -106,6 +141,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -116,6 +155,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -718,6 +761,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() let node0000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -727,6 +771,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -738,6 +786,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -749,6 +801,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -758,6 +814,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() let node1000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -767,6 +824,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-2f32), bottom: zero() }, ..Default::default() }, @@ -778,6 +839,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -789,6 +854,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -798,6 +867,7 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() let node2000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -807,6 +877,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(15f32), bottom: zero() }, ..Default::default() }, @@ -818,6 +892,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: zero() }, ..Default::default() }, @@ -829,6 +907,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: zero() }, ..Default::default() }, @@ -840,6 +922,10 @@ fn block_margin_y_first_granchild_collapse_positive_and_negative__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 ef633b313..e318e4555 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 @@ -6,6 +6,7 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { let mut taffy = crate::new_test_tree(); let node0000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -44,6 +57,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -286,6 +303,7 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { let node0000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -295,6 +313,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -306,6 +328,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -317,6 +343,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -328,6 +358,10 @@ fn block_margin_y_first_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 76a51a7f2..16c657d55 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_blocked_by_border_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 d0bca3451..5febe1e5e 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__border_box() let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__content_box( let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_hidden__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 3e474bf7c..3630460cd 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__border_box() let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__content_box( let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_x_scroll__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 c86082342..7f607d41d 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__border_box() let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__content_box( let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_hidden__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 2ae74fbca..a517aa40d 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__border_box() let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -39,6 +44,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__border_box() .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -230,6 +239,7 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__content_box( let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -239,6 +249,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -266,6 +280,10 @@ fn block_margin_y_last_child_collapse_blocked_by_overflow_y_scroll__content_box( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7ce955619..1c2a0d931 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -35,6 +44,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -226,6 +239,7 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -235,6 +249,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -246,6 +264,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(1f32) }, ..Default::default() @@ -258,6 +280,10 @@ fn block_margin_y_last_child_collapse_blocked_by_padding_bottom__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 2219ed944..fed0b46c1 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_negative_equal__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_negative_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_negative_equal__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_negative_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 bb87dc4f3..285705ab6 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_negative_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9219bc83e..7a212acb0 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_negative_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9d15edb8e..a9757c60b 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_border_top__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 f5cc867c8..942a934f5 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -35,6 +44,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -226,6 +239,7 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__content_box() let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -235,6 +249,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -246,6 +264,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: length(1f32), bottom: zero() }, ..Default::default() @@ -258,6 +280,10 @@ fn block_margin_y_last_child_collapse_not_blocked_by_padding_top__content_box() taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 af5520ace..088feeaff 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -32,6 +41,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .unwrap(); let node100 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -40,6 +50,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -50,6 +64,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -58,6 +76,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .unwrap(); let node200 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -66,6 +85,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -76,6 +99,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -86,6 +113,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -535,6 +566,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -544,6 +576,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -555,6 +591,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -564,6 +604,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { let node100 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -573,6 +614,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -584,6 +629,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-10f32) }, ..Default::default() }, @@ -593,6 +642,7 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { let node200 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -602,6 +652,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -613,6 +667,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(-5f32) }, ..Default::default() }, @@ -624,6 +682,10 @@ fn block_margin_y_last_child_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 debdf14eb..20629b02d 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_positive_equal__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_positive_equal__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 5200fd1f2..31ba23720 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_positive_parent_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 e61ea4cb4..0058fd3a2 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(5f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn block_margin_y_last_child_collapse_positive_parent_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 e844e1349..809c915c3 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 @@ -6,6 +6,7 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { let mut taffy = crate::new_test_tree(); let node0000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -44,6 +57,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -286,6 +303,7 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { let node0000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -295,6 +313,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -306,6 +328,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -317,6 +343,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -328,6 +358,10 @@ fn block_margin_y_last_granchild_collapse_positive_equal__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 a2cd7372d..8c3a2005b 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_negative.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_negative.rs @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_sibling_collapse_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_margin_y_sibling_collapse_negative__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -27,6 +30,7 @@ fn block_margin_y_sibling_collapse_negative__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -36,6 +40,10 @@ fn block_margin_y_sibling_collapse_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -254,6 +262,7 @@ fn block_margin_y_sibling_collapse_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -262,6 +271,7 @@ fn block_margin_y_sibling_collapse_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -270,6 +280,7 @@ fn block_margin_y_sibling_collapse_negative__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -278,6 +289,7 @@ fn block_margin_y_sibling_collapse_negative__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -288,6 +300,10 @@ fn block_margin_y_sibling_collapse_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 7e90ca35d..7daf8ce7e 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 @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -18,6 +19,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -30,6 +32,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -42,6 +45,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -56,6 +60,10 @@ fn block_margin_y_sibling_collapse_negative_percentage__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -274,6 +282,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -287,6 +296,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -300,6 +310,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -313,6 +324,7 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -328,6 +340,10 @@ fn block_margin_y_sibling_collapse_negative_percentage__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 eac042235..79feb6e81 100644 --- a/tests/generated/block/block_margin_y_sibling_collapse_positive.rs +++ b/tests/generated/block/block_margin_y_sibling_collapse_positive.rs @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_sibling_collapse_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_margin_y_sibling_collapse_positive__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(5f32) }, ..Default::default() @@ -27,6 +30,7 @@ fn block_margin_y_sibling_collapse_positive__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -36,6 +40,10 @@ fn block_margin_y_sibling_collapse_positive__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -254,6 +262,7 @@ fn block_margin_y_sibling_collapse_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -262,6 +271,7 @@ fn block_margin_y_sibling_collapse_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -270,6 +280,7 @@ fn block_margin_y_sibling_collapse_positive__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(5f32) }, ..Default::default() @@ -278,6 +289,7 @@ fn block_margin_y_sibling_collapse_positive__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -288,6 +300,10 @@ fn block_margin_y_sibling_collapse_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 aa21ac637..61831cbb8 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 @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(10f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(5f32) }, ..Default::default() @@ -27,6 +30,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -34,6 +38,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(-10f32) }, ..Default::default() @@ -41,6 +46,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(-5f32) }, ..Default::default() @@ -48,6 +54,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -57,6 +64,10 @@ fn block_margin_y_sibling_collapse_positive_and_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -392,6 +403,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -400,6 +412,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(10f32) }, ..Default::default() @@ -408,6 +421,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(5f32) }, ..Default::default() @@ -416,6 +430,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -424,6 +439,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(-10f32) }, ..Default::default() @@ -432,6 +448,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(5f32), bottom: length(-5f32) }, ..Default::default() @@ -440,6 +457,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -450,6 +468,10 @@ fn block_margin_y_sibling_collapse_positive_and_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 24b092e2d..712409a7c 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 @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -18,6 +19,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -30,6 +32,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -42,6 +45,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -54,6 +58,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -66,6 +71,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -78,6 +84,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -92,6 +99,10 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__border_box( .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -427,6 +438,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -440,6 +452,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -453,6 +466,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -466,6 +480,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -479,6 +494,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -492,6 +508,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -505,6 +522,7 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -520,6 +538,10 @@ fn block_margin_y_sibling_collapse_positive_and_negative_percentage__content_box taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 c6be6345e..d197c01f1 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 @@ -6,6 +6,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -18,6 +19,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -30,6 +32,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -42,6 +45,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -56,6 +60,10 @@ fn block_margin_y_sibling_collapse_positive_percentage__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -274,6 +282,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -287,6 +296,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -300,6 +310,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -313,6 +324,7 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -328,6 +340,10 @@ fn block_margin_y_sibling_collapse_positive_percentage__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_margin_y_simple_negative.rs b/tests/generated/block/block_margin_y_simple_negative.rs index 6294a3cc4..1446c4780 100644 --- a/tests/generated/block/block_margin_y_simple_negative.rs +++ b/tests/generated/block/block_margin_y_simple_negative.rs @@ -6,6 +6,7 @@ fn block_margin_y_simple_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_simple_negative__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn block_margin_y_simple_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -161,6 +167,7 @@ fn block_margin_y_simple_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -169,6 +176,7 @@ fn block_margin_y_simple_negative__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -178,6 +186,10 @@ fn block_margin_y_simple_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 9395d7bfb..9b1badf5c 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 @@ -6,6 +6,7 @@ fn block_margin_y_simple_negative_percentage_other__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -18,6 +19,7 @@ fn block_margin_y_simple_negative_percentage_other__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -29,6 +31,10 @@ fn block_margin_y_simple_negative_percentage_other__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_y_simple_negative_percentage_other__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -182,6 +189,7 @@ fn block_margin_y_simple_negative_percentage_other__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -194,6 +202,10 @@ fn block_margin_y_simple_negative_percentage_other__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 217cee67e..1a5d5fc51 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 @@ -6,6 +6,7 @@ fn block_margin_y_simple_negative_percentage_self__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,6 +22,7 @@ fn block_margin_y_simple_negative_percentage_self__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -29,6 +31,10 @@ fn block_margin_y_simple_negative_percentage_self__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn block_margin_y_simple_negative_percentage_self__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +192,7 @@ fn block_margin_y_simple_negative_percentage_self__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -194,6 +202,10 @@ fn block_margin_y_simple_negative_percentage_self__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_margin_y_simple_positive.rs b/tests/generated/block/block_margin_y_simple_positive.rs index fbf35332a..441fe4acd 100644 --- a/tests/generated/block/block_margin_y_simple_positive.rs +++ b/tests/generated/block/block_margin_y_simple_positive.rs @@ -6,6 +6,7 @@ fn block_margin_y_simple_positive__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_simple_positive__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn block_margin_y_simple_positive__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -161,6 +167,7 @@ fn block_margin_y_simple_positive__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -169,6 +176,7 @@ fn block_margin_y_simple_positive__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -178,6 +186,10 @@ fn block_margin_y_simple_positive__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 46f1c0a5a..b5be2332c 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 @@ -6,6 +6,7 @@ fn block_margin_y_simple_positive_percentage_other__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -18,6 +19,7 @@ fn block_margin_y_simple_positive_percentage_other__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,7 +29,14 @@ fn block_margin_y_simple_positive_percentage_other__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -165,6 +174,7 @@ fn block_margin_y_simple_positive_percentage_other__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -178,6 +188,7 @@ fn block_margin_y_simple_positive_percentage_other__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -190,6 +201,10 @@ fn block_margin_y_simple_positive_percentage_other__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 1d8599e44..86571ac0e 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 @@ -6,6 +6,7 @@ fn block_margin_y_simple_positive_percentage_self__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,13 +22,21 @@ fn block_margin_y_simple_positive_percentage_self__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -165,6 +174,7 @@ fn block_margin_y_simple_positive_percentage_self__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -181,6 +191,7 @@ fn block_margin_y_simple_positive_percentage_self__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -190,6 +201,10 @@ fn block_margin_y_simple_positive_percentage_self__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/block/block_margin_y_total_collapse.rs b/tests/generated/block/block_margin_y_total_collapse.rs index 581863e78..d2cbe6b42 100644 --- a/tests/generated/block/block_margin_y_total_collapse.rs +++ b/tests/generated/block/block_margin_y_total_collapse.rs @@ -7,6 +7,7 @@ fn block_margin_y_total_collapse__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn block_margin_y_total_collapse__border_box() { let node01 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn block_margin_y_total_collapse__border_box() { let node02 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn block_margin_y_total_collapse__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -47,6 +54,10 @@ fn block_margin_y_total_collapse__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -278,6 +289,7 @@ fn block_margin_y_total_collapse__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -287,6 +299,7 @@ fn block_margin_y_total_collapse__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -295,6 +308,7 @@ fn block_margin_y_total_collapse__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -305,6 +319,10 @@ fn block_margin_y_total_collapse__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -322,6 +340,10 @@ fn block_margin_y_total_collapse__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 ae37fe729..45991a97f 100644 --- a/tests/generated/block/block_margin_y_total_collapse_complex.rs +++ b/tests/generated/block/block_margin_y_total_collapse_complex.rs @@ -6,6 +6,7 @@ fn block_margin_y_total_collapse_complex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn block_margin_y_total_collapse_complex__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn block_margin_y_total_collapse_complex__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: length(3f32) }, ..Default::default() @@ -27,6 +30,7 @@ fn block_margin_y_total_collapse_complex__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-6f32), bottom: length(9f32) }, ..Default::default() @@ -35,6 +39,10 @@ fn block_margin_y_total_collapse_complex__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -49,6 +57,7 @@ fn block_margin_y_total_collapse_complex__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -56,6 +65,7 @@ fn block_margin_y_total_collapse_complex__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -65,6 +75,10 @@ fn block_margin_y_total_collapse_complex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -418,6 +432,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -426,6 +441,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -434,6 +450,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(7f32), bottom: length(3f32) }, ..Default::default() @@ -442,6 +459,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-6f32), bottom: length(9f32) }, ..Default::default() @@ -451,6 +469,10 @@ fn block_margin_y_total_collapse_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), @@ -466,6 +488,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-5f32), bottom: length(-5f32) }, ..Default::default() @@ -474,6 +497,7 @@ fn block_margin_y_total_collapse_complex__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(-10f32), bottom: length(-10f32) }, ..Default::default() @@ -484,6 +508,10 @@ fn block_margin_y_total_collapse_complex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs index 902161a11..64f405d6b 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_available_space.rs @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_overridden_by_available_space__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -34,6 +35,10 @@ fn block_overflow_scrollbars_overridden_by_available_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), @@ -178,6 +183,7 @@ fn block_overflow_scrollbars_overridden_by_available_space__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -207,6 +213,10 @@ fn block_overflow_scrollbars_overridden_by_available_space__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs index 124b3b061..3b72e309c 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_max_size.rs @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_overridden_by_max_size__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -130,6 +131,7 @@ fn block_overflow_scrollbars_overridden_by_max_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), diff --git a/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs b/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs index 85a9562f7..1f3448b44 100644 --- a/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/block/block_overflow_scrollbars_overridden_by_size.rs @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_overridden_by_size__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -130,6 +131,7 @@ fn block_overflow_scrollbars_overridden_by_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), 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 099742c38..182d08737 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 @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_take_up_space_both_axis__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -130,6 +131,7 @@ fn block_overflow_scrollbars_take_up_space_both_axis__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), 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 c008ab3d4..41ef4a7ae 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 @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_take_up_space_cross_axis__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -130,6 +131,7 @@ fn block_overflow_scrollbars_take_up_space_cross_axis__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), 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 d791b52e6..2ccc780a1 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 @@ -7,6 +7,7 @@ fn block_overflow_scrollbars_take_up_space_main_axis__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), @@ -130,6 +131,7 @@ fn block_overflow_scrollbars_take_up_space_main_axis__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: length(0f32), diff --git a/tests/generated/block/block_padding_border_fixed_size.rs b/tests/generated/block/block_padding_border_fixed_size.rs index 79f4488c8..f3d9dff62 100644 --- a/tests/generated/block/block_padding_border_fixed_size.rs +++ b/tests/generated/block/block_padding_border_fixed_size.rs @@ -6,12 +6,14 @@ fn block_padding_border_fixed_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -20,6 +22,10 @@ fn block_padding_border_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -175,6 +181,7 @@ fn block_padding_border_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -182,6 +189,7 @@ fn block_padding_border_fixed_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -191,6 +199,10 @@ fn block_padding_border_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_padding_border_intrinsic_size.rs b/tests/generated/block/block_padding_border_intrinsic_size.rs index 291d0287b..624f66044 100644 --- a/tests/generated/block/block_padding_border_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_intrinsic_size.rs @@ -6,6 +6,7 @@ fn block_padding_border_intrinsic_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn block_padding_border_intrinsic_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -23,6 +25,10 @@ fn block_padding_border_intrinsic_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(7f32), right: length(3f32), @@ -174,6 +180,7 @@ fn block_padding_border_intrinsic_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -184,6 +191,7 @@ fn block_padding_border_intrinsic_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -193,6 +201,10 @@ fn block_padding_border_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(7f32), right: length(3f32), 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 660c5e336..22b404796 100644 --- a/tests/generated/block/block_padding_border_overrides_max_size.rs +++ b/tests/generated/block/block_padding_border_overrides_max_size.rs @@ -4,11 +4,20 @@ fn block_padding_border_overrides_max_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -32,7 +41,14 @@ fn block_padding_border_overrides_max_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -168,13 +184,21 @@ fn block_padding_border_overrides_max_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -201,6 +225,10 @@ fn block_padding_border_overrides_max_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 0daa91b6a..93f53cd3d 100644 --- a/tests/generated/block/block_padding_border_overrides_min_size.rs +++ b/tests/generated/block/block_padding_border_overrides_min_size.rs @@ -4,11 +4,20 @@ fn block_padding_border_overrides_min_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -32,7 +41,14 @@ fn block_padding_border_overrides_min_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -168,13 +184,21 @@ fn block_padding_border_overrides_min_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -201,6 +225,10 @@ fn block_padding_border_overrides_min_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/block/block_padding_border_overrides_size.rs b/tests/generated/block/block_padding_border_overrides_size.rs index 6e73976fd..8cfe930c8 100644 --- a/tests/generated/block/block_padding_border_overrides_size.rs +++ b/tests/generated/block/block_padding_border_overrides_size.rs @@ -4,11 +4,20 @@ fn block_padding_border_overrides_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -32,7 +41,14 @@ fn block_padding_border_overrides_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -168,13 +184,21 @@ fn block_padding_border_overrides_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -201,6 +225,10 @@ fn block_padding_border_overrides_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 30cb19417..006a096ea 100644 --- a/tests/generated/block/block_padding_border_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_border_percentage_fixed_size.rs @@ -7,6 +7,7 @@ fn block_padding_border_percentage_fixed_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -15,6 +16,10 @@ fn block_padding_border_percentage_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -30,6 +35,10 @@ fn block_padding_border_percentage_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -180,6 +189,7 @@ fn block_padding_border_percentage_fixed_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -189,6 +199,10 @@ fn block_padding_border_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -205,6 +219,10 @@ fn block_padding_border_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), 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 baf1acfb6..4af989fcc 100644 --- a/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_border_percentage_intrinsic_size.rs @@ -7,6 +7,7 @@ fn block_padding_border_percentage_intrinsic_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -15,6 +16,10 @@ fn block_padding_border_percentage_intrinsic_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -28,7 +33,14 @@ fn block_padding_border_percentage_intrinsic_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -173,6 +185,7 @@ fn block_padding_border_percentage_intrinsic_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -182,6 +195,10 @@ fn block_padding_border_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -198,6 +215,10 @@ fn block_padding_border_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/block/block_padding_fixed_size.rs b/tests/generated/block/block_padding_fixed_size.rs index 06dfbaf63..7e0ba077c 100644 --- a/tests/generated/block/block_padding_fixed_size.rs +++ b/tests/generated/block/block_padding_fixed_size.rs @@ -6,12 +6,14 @@ fn block_padding_fixed_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -20,6 +22,10 @@ fn block_padding_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -169,6 +175,7 @@ fn block_padding_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -176,6 +183,7 @@ fn block_padding_fixed_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -185,6 +193,10 @@ fn block_padding_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_padding_intrinsic_size.rs b/tests/generated/block/block_padding_intrinsic_size.rs index e07e15bac..8e5453ae1 100644 --- a/tests/generated/block/block_padding_intrinsic_size.rs +++ b/tests/generated/block/block_padding_intrinsic_size.rs @@ -6,6 +6,7 @@ fn block_padding_intrinsic_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn block_padding_intrinsic_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -23,6 +25,10 @@ fn block_padding_intrinsic_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), @@ -168,6 +174,7 @@ fn block_padding_intrinsic_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -178,6 +185,7 @@ fn block_padding_intrinsic_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -187,6 +195,10 @@ fn block_padding_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), diff --git a/tests/generated/block/block_padding_percentage_fixed_size.rs b/tests/generated/block/block_padding_percentage_fixed_size.rs index cdc740c6c..9f8956937 100644 --- a/tests/generated/block/block_padding_percentage_fixed_size.rs +++ b/tests/generated/block/block_padding_percentage_fixed_size.rs @@ -7,6 +7,7 @@ fn block_padding_percentage_fixed_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -15,6 +16,10 @@ fn block_padding_percentage_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -30,6 +35,10 @@ fn block_padding_percentage_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -180,6 +189,7 @@ fn block_padding_percentage_fixed_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -189,6 +199,10 @@ fn block_padding_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -205,6 +219,10 @@ fn block_padding_percentage_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/block/block_padding_percentage_intrinsic_size.rs b/tests/generated/block/block_padding_percentage_intrinsic_size.rs index 004371b3e..25d8fbe2b 100644 --- a/tests/generated/block/block_padding_percentage_intrinsic_size.rs +++ b/tests/generated/block/block_padding_percentage_intrinsic_size.rs @@ -7,6 +7,7 @@ fn block_padding_percentage_intrinsic_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -15,6 +16,10 @@ fn block_padding_percentage_intrinsic_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -28,7 +33,14 @@ fn block_padding_percentage_intrinsic_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -173,6 +185,7 @@ fn block_padding_percentage_intrinsic_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -182,6 +195,10 @@ fn block_padding_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: percent(0.04f32), right: percent(0.02f32), @@ -198,6 +215,10 @@ fn block_padding_percentage_intrinsic_size__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/blockflex/blockflex_block_in_flex_column.rs b/tests/generated/blockflex/blockflex_block_in_flex_column.rs index f2328dcae..4c97feaa0 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_column.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_column.rs @@ -4,11 +4,17 @@ fn blockflex_block_in_flex_column__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -18,6 +24,10 @@ fn blockflex_block_in_flex_column__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(50f32), @@ -162,6 +172,7 @@ fn blockflex_block_in_flex_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -169,6 +180,7 @@ fn blockflex_block_in_flex_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -179,6 +191,10 @@ fn blockflex_block_in_flex_column__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/blockflex/blockflex_block_in_flex_row.rs b/tests/generated/blockflex/blockflex_block_in_flex_row.rs index 28f661bc2..280f5d253 100644 --- a/tests/generated/blockflex/blockflex_block_in_flex_row.rs +++ b/tests/generated/blockflex/blockflex_block_in_flex_row.rs @@ -4,11 +4,17 @@ fn blockflex_block_in_flex_row__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -17,6 +23,10 @@ fn blockflex_block_in_flex_row__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(50f32), @@ -161,6 +171,7 @@ fn blockflex_block_in_flex_row__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -168,6 +179,7 @@ fn blockflex_block_in_flex_row__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -177,6 +189,10 @@ fn blockflex_block_in_flex_row__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/blockflex/blockflex_flex_in_block.rs b/tests/generated/blockflex/blockflex_flex_in_block.rs index 4c5c142d6..782008e30 100644 --- a/tests/generated/blockflex/blockflex_flex_in_block.rs +++ b/tests/generated/blockflex/blockflex_flex_in_block.rs @@ -6,6 +6,7 @@ fn blockflex_flex_in_block__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,13 +16,21 @@ fn blockflex_flex_in_block__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +42,10 @@ fn blockflex_flex_in_block__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -218,6 +231,7 @@ fn blockflex_flex_in_block__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -230,6 +244,10 @@ fn blockflex_flex_in_block__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -239,6 +257,7 @@ fn blockflex_flex_in_block__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -251,6 +270,10 @@ fn blockflex_flex_in_block__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, 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 b1639f9a9..95182b974 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 @@ -7,6 +7,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn blockflex_margin_y_collapse_through_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 06020e20e..ea3972826 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 @@ -6,6 +6,7 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn blockflex_margin_y_first_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 d72e07f20..218f95cab 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 @@ -6,6 +6,7 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn blockflex_margin_y_last_child_collapse_blocked_by_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/blockflex/blockflex_overflow_hidden.rs b/tests/generated/blockflex/blockflex_overflow_hidden.rs index 2c6b2c705..b1070a153 100644 --- a/tests/generated/blockflex/blockflex_overflow_hidden.rs +++ b/tests/generated/blockflex/blockflex_overflow_hidden.rs @@ -21,7 +21,15 @@ fn blockflex_overflow_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, flex_grow: 1f32, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -29,6 +37,10 @@ fn blockflex_overflow_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(50f32), @@ -190,6 +202,10 @@ fn blockflex_overflow_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -201,6 +217,10 @@ fn blockflex_overflow_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs index 988993db6..4fc3fcfae 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_auto.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_auto__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto()], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_auto__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_auto__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_auto__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto()], ..Default::default() }, 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 8e537b382..b98f527bc 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 @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(50f32))], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(50f32))], ..Default::default() }, 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 299aeb8a4..78a9c23ef 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 @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_middle__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() }, 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 7f5c705b7..c09720576 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 @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(10f32))], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_fit_content_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fit_content(length(10f32))], ..Default::default() }, 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 269c7ab09..03183378f 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_larger.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_larger__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(50f32)], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_larger__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_larger__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(50f32)], ..Default::default() }, 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 34fc6a3a7..76f3b7121 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_middle.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_middle__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(30f32)], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_middle__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_middle__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_middle__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(30f32)], ..Default::default() }, 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 91d5c0648..9810b2553 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fixed_smaller.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fixed_smaller__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(10f32)], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fixed_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fixed_smaller__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fixed_smaller__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![length(10f32)], ..Default::default() }, diff --git a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs index 8e3f39571..dbcb69920 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_fr.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_fr__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fr(1f32)], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_fr__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_fr__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_fr__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![fr(1f32)], ..Default::default() }, 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 968c7aea2..460b5758d 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_max_content.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_max_content__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, 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 dc621f3f0..813f0a6d1 100644 --- a/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs +++ b/tests/generated/blockgrid/blockgrid_block_in_grid_min_content.rs @@ -6,16 +6,32 @@ fn blockgrid_block_in_grid_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, @@ -158,6 +174,10 @@ fn blockgrid_block_in_grid_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), @@ -167,6 +187,7 @@ fn blockgrid_block_in_grid_min_content__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -175,6 +196,10 @@ fn blockgrid_block_in_grid_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, diff --git a/tests/generated/blockgrid/blockgrid_grid_in_block.rs b/tests/generated/blockgrid/blockgrid_grid_in_block.rs index 6d6e2c24e..a0177c121 100644 --- a/tests/generated/blockgrid/blockgrid_grid_in_block.rs +++ b/tests/generated/blockgrid/blockgrid_grid_in_block.rs @@ -6,6 +6,7 @@ fn blockgrid_grid_in_block__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,13 +16,21 @@ fn blockgrid_grid_in_block__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +42,10 @@ fn blockgrid_grid_in_block__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -218,6 +231,7 @@ fn blockgrid_grid_in_block__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -230,6 +244,10 @@ fn blockgrid_grid_in_block__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -239,6 +257,7 @@ fn blockgrid_grid_in_block__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -251,6 +270,10 @@ fn blockgrid_grid_in_block__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, 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 583f3d37f..81474b74e 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 @@ -7,6 +7,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -22,6 +24,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -31,6 +34,10 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -211,6 +218,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() }) @@ -228,6 +237,7 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -238,6 +248,10 @@ fn blockgrid_margin_y_collapse_through_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 5ed95647d..a6c6bd638 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 @@ -6,6 +6,7 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -34,6 +43,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -245,6 +263,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -256,6 +278,10 @@ fn blockgrid_margin_y_first_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 6520f47c4..5487eaf87 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 @@ -6,6 +6,7 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -14,6 +15,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -34,6 +43,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -225,6 +238,7 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -234,6 +248,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -245,6 +263,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }, @@ -256,6 +278,10 @@ fn blockgrid_margin_y_last_child_collapse_blocked_by_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, 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 c79668574..664840138 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 @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__border_box let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -21,6 +22,10 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__border_box .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__content_bo .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -147,6 +153,10 @@ fn absolute_aspect_ratio_aspect_ratio_overrides_height_of_full_inset__content_bo taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs index fadb2b3bd..f1d478e6c 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_height.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn absolute_aspect_ratio_fill_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn absolute_aspect_ratio_fill_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn absolute_aspect_ratio_fill_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 6dc009f8f..9c62a8dff 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 @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_height_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -21,6 +22,10 @@ fn absolute_aspect_ratio_fill_height_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn absolute_aspect_ratio_fill_height_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -147,6 +153,10 @@ fn absolute_aspect_ratio_fill_height_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 3bce2000d..2847e2e41 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_height.rs @@ -10,6 +10,10 @@ fn absolute_aspect_ratio_fill_max_height__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -21,6 +25,10 @@ fn absolute_aspect_ratio_fill_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -129,6 +137,10 @@ fn absolute_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -141,6 +153,10 @@ fn absolute_aspect_ratio_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 1fc95f02c..e70ae5415 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_max_width.rs @@ -10,6 +10,10 @@ fn absolute_aspect_ratio_fill_max_width__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -21,6 +25,10 @@ fn absolute_aspect_ratio_fill_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -129,6 +137,10 @@ fn absolute_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -141,6 +153,10 @@ fn absolute_aspect_ratio_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 da681b585..d1f423fc2 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_height.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_min_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -16,6 +17,10 @@ fn absolute_aspect_ratio_fill_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn absolute_aspect_ratio_fill_min_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(3f32), ..Default::default() @@ -131,6 +137,10 @@ fn absolute_aspect_ratio_fill_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 e6d4087d3..b998d0b4f 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_min_width.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_min_width__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -16,6 +17,10 @@ fn absolute_aspect_ratio_fill_min_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn absolute_aspect_ratio_fill_min_width__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(0.5f32), ..Default::default() @@ -131,6 +137,10 @@ fn absolute_aspect_ratio_fill_min_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), diff --git a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs index 4034ef61e..ead2d206a 100644 --- a/tests/generated/flex/absolute_aspect_ratio_fill_width.rs +++ b/tests/generated/flex/absolute_aspect_ratio_fill_width.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_width__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn absolute_aspect_ratio_fill_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn absolute_aspect_ratio_fill_width__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn absolute_aspect_ratio_fill_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 2f4af5598..db778d98a 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 @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_fill_width_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn absolute_aspect_ratio_fill_width_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn absolute_aspect_ratio_fill_width_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -131,6 +137,10 @@ fn absolute_aspect_ratio_fill_width_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 97f68659f..6fe83107a 100644 --- a/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_height_overrides_inset.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_height_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -17,6 +18,10 @@ fn absolute_aspect_ratio_height_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -122,6 +127,7 @@ fn absolute_aspect_ratio_height_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -133,6 +139,10 @@ fn absolute_aspect_ratio_height_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 58292ab42..25b537ac2 100644 --- a/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs +++ b/tests/generated/flex/absolute_aspect_ratio_width_overrides_inset.rs @@ -7,6 +7,7 @@ fn absolute_aspect_ratio_width_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn absolute_aspect_ratio_width_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn absolute_aspect_ratio_width_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn absolute_aspect_ratio_width_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), diff --git a/tests/generated/flex/absolute_child_with_cross_margin.rs b/tests/generated/flex/absolute_child_with_cross_margin.rs index 2e9a2b984..9d09e3d4a 100644 --- a/tests/generated/flex/absolute_child_with_cross_margin.rs +++ b/tests/generated/flex/absolute_child_with_cross_margin.rs @@ -6,6 +6,7 @@ fn absolute_child_with_cross_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(28f32), @@ -18,6 +19,10 @@ fn absolute_child_with_cross_margin__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_grow: 0f32, flex_shrink: 1f32, @@ -33,6 +38,7 @@ fn absolute_child_with_cross_margin__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -44,6 +50,10 @@ fn absolute_child_with_cross_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(311f32), @@ -231,6 +241,7 @@ fn absolute_child_with_cross_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(28f32), @@ -244,6 +255,10 @@ fn absolute_child_with_cross_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_grow: 0f32, flex_shrink: 1f32, @@ -260,6 +275,7 @@ fn absolute_child_with_cross_margin__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -272,6 +288,10 @@ fn absolute_child_with_cross_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(311f32), diff --git a/tests/generated/flex/absolute_child_with_main_margin.rs b/tests/generated/flex/absolute_child_with_main_margin.rs index b9512aa7d..774209599 100644 --- a/tests/generated/flex/absolute_child_with_main_margin.rs +++ b/tests/generated/flex/absolute_child_with_main_margin.rs @@ -7,6 +7,7 @@ fn absolute_child_with_main_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -18,6 +19,10 @@ fn absolute_child_with_main_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), @@ -123,6 +128,7 @@ fn absolute_child_with_main_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(9f32), height: taffy::style::Dimension::from_length(9f32), @@ -135,6 +141,10 @@ fn absolute_child_with_main_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(37f32), diff --git a/tests/generated/flex/absolute_child_with_max_height.rs b/tests/generated/flex/absolute_child_with_max_height.rs index 6c327b822..3ab0cfa2b 100644 --- a/tests/generated/flex/absolute_child_with_max_height.rs +++ b/tests/generated/flex/absolute_child_with_max_height.rs @@ -6,6 +6,7 @@ fn absolute_child_with_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(30f32), @@ -18,6 +19,10 @@ fn absolute_child_with_max_height__border_box() { taffy::style::Style { position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -29,6 +34,10 @@ fn absolute_child_with_max_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -178,6 +187,7 @@ fn absolute_child_with_max_height__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(30f32), @@ -191,6 +201,10 @@ fn absolute_child_with_max_height__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -203,6 +217,10 @@ fn absolute_child_with_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), 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 33db873c3..f58a97f0b 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 @@ -6,6 +6,7 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(150f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -17,6 +18,10 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__border_box() { taffy::style::Style { position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -28,6 +33,10 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -183,6 +192,7 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(150f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -195,6 +205,10 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: auto(), bottom: length(20f32) }, ..Default::default() @@ -207,6 +221,10 @@ fn absolute_child_with_max_height_larger_shrinkable_grandchild__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), 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 37d90d66c..6a384ac31 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_center__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -17,6 +18,10 @@ fn absolute_layout_align_items_and_justify_content_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -124,6 +129,7 @@ fn absolute_layout_align_items_and_justify_content_center__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -135,6 +141,10 @@ fn absolute_layout_align_items_and_justify_content_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 aae466ac7..4eeb71a33 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__b let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -18,6 +19,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__b let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -125,6 +130,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__c .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -137,6 +143,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_bottom_position__c .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 ee6ec7989..fa13ee9c1 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__bor let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -18,6 +19,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__bor let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -125,6 +130,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__con .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -137,6 +143,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_left_position__con .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 35a6478ef..5397736cc 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__bo let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -18,6 +19,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__bo let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -125,6 +130,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__co .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -137,6 +143,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_right_position__co .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 2750a1b39..bd7012a47 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__bord let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -18,6 +19,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__bord let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -125,6 +130,7 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__cont .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -137,6 +143,10 @@ fn absolute_layout_align_items_and_justify_content_center_and_top_position__cont .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 d9146b066..86abe08b7 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_and_justify_content_flex_end__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -17,6 +18,10 @@ fn absolute_layout_align_items_and_justify_content_flex_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { @@ -124,6 +129,7 @@ fn absolute_layout_align_items_and_justify_content_flex_end__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -135,6 +141,10 @@ fn absolute_layout_align_items_and_justify_content_flex_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { diff --git a/tests/generated/flex/absolute_layout_align_items_center.rs b/tests/generated/flex/absolute_layout_align_items_center.rs index 29a16f0c9..dff7ca2ba 100644 --- a/tests/generated/flex/absolute_layout_align_items_center.rs +++ b/tests/generated/flex/absolute_layout_align_items_center.rs @@ -7,6 +7,7 @@ fn absolute_layout_align_items_center__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -17,6 +18,10 @@ fn absolute_layout_align_items_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), @@ -123,6 +128,7 @@ fn absolute_layout_align_items_center__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -134,6 +140,10 @@ fn absolute_layout_align_items_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), 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 f3b513980..826c43707 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 @@ -7,6 +7,7 @@ fn absolute_layout_align_items_center_on_child_only__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -18,6 +19,10 @@ fn absolute_layout_align_items_center_on_child_only__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_align_items_center_on_child_only__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -135,6 +141,10 @@ fn absolute_layout_align_items_center_on_child_only__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/absolute_layout_child_order.rs b/tests/generated/flex/absolute_layout_child_order.rs index 346424846..c12a630d8 100644 --- a/tests/generated/flex/absolute_layout_child_order.rs +++ b/tests/generated/flex/absolute_layout_child_order.rs @@ -6,6 +6,7 @@ fn absolute_layout_child_order__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -16,6 +17,7 @@ fn absolute_layout_child_order__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -25,6 +27,7 @@ fn absolute_layout_child_order__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -35,6 +38,10 @@ fn absolute_layout_child_order__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -219,6 +226,7 @@ fn absolute_layout_child_order__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -230,6 +238,7 @@ fn absolute_layout_child_order__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -240,6 +249,7 @@ fn absolute_layout_child_order__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -251,6 +261,10 @@ fn absolute_layout_child_order__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 7c7377e50..6e4dafd56 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 @@ -7,6 +7,7 @@ fn absolute_layout_in_wrap_reverse_column_container__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -19,6 +20,10 @@ fn absolute_layout_in_wrap_reverse_column_container__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn absolute_layout_in_wrap_reverse_column_container__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -137,6 +143,10 @@ fn absolute_layout_in_wrap_reverse_column_container__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 cd021fb54..2ffdc2514 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 @@ -7,6 +7,7 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -20,6 +21,10 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -139,6 +145,10 @@ fn absolute_layout_in_wrap_reverse_column_container_flex_end__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 0913a46ee..fbeea02a7 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 @@ -7,6 +7,7 @@ fn absolute_layout_in_wrap_reverse_row_container__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn absolute_layout_in_wrap_reverse_row_container__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_in_wrap_reverse_row_container__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -135,6 +141,10 @@ fn absolute_layout_in_wrap_reverse_row_container__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 e50169c99..9e71f5a71 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 @@ -7,6 +7,7 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -19,6 +20,10 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -137,6 +143,10 @@ fn absolute_layout_in_wrap_reverse_row_container_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/absolute_layout_justify_content_center.rs b/tests/generated/flex/absolute_layout_justify_content_center.rs index e7e81d4ba..563439611 100644 --- a/tests/generated/flex/absolute_layout_justify_content_center.rs +++ b/tests/generated/flex/absolute_layout_justify_content_center.rs @@ -7,6 +7,7 @@ fn absolute_layout_justify_content_center__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -17,6 +18,10 @@ fn absolute_layout_justify_content_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), @@ -123,6 +128,7 @@ fn absolute_layout_justify_content_center__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(40f32), @@ -134,6 +140,10 @@ fn absolute_layout_justify_content_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), diff --git a/tests/generated/flex/absolute_layout_no_size.rs b/tests/generated/flex/absolute_layout_no_size.rs index ace7d970c..a52282415 100644 --- a/tests/generated/flex/absolute_layout_no_size.rs +++ b/tests/generated/flex/absolute_layout_no_size.rs @@ -5,11 +5,19 @@ fn absolute_layout_no_size__border_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }) + .new_leaf(taffy::style::Style { + position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -115,6 +123,7 @@ fn absolute_layout_no_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -122,6 +131,10 @@ fn absolute_layout_no_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 f2e39c3e9..1f58ce69d 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 @@ -7,6 +7,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -18,6 +19,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -29,6 +31,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.1f32), bottom: percent(0.1f32) }, ..Default::default() @@ -37,6 +40,10 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -226,6 +233,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -238,6 +246,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -250,6 +259,7 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.1f32), bottom: percent(0.1f32) }, ..Default::default() @@ -259,6 +269,10 @@ fn absolute_layout_percentage_bottom_based_on_parent_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/absolute_layout_percentage_height.rs b/tests/generated/flex/absolute_layout_percentage_height.rs index 8a2b3a375..678e764aa 100644 --- a/tests/generated/flex/absolute_layout_percentage_height.rs +++ b/tests/generated/flex/absolute_layout_percentage_height.rs @@ -7,6 +7,7 @@ fn absolute_layout_percentage_height__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -18,6 +19,10 @@ fn absolute_layout_percentage_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_percentage_height__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -135,6 +141,10 @@ fn absolute_layout_percentage_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), 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 a36145cdc..b1045daeb 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 @@ -7,6 +7,7 @@ fn absolute_layout_row_width_height_end_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -18,6 +19,10 @@ fn absolute_layout_row_width_height_end_bottom__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_row_width_height_end_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -135,6 +141,10 @@ fn absolute_layout_row_width_height_end_bottom__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 2cb41e07a..c7d9467d3 100644 --- a/tests/generated/flex/absolute_layout_start_top_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_start_top_end_bottom.rs @@ -7,6 +7,7 @@ fn absolute_layout_start_top_end_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -19,6 +20,10 @@ fn absolute_layout_start_top_end_bottom__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn absolute_layout_start_top_end_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -137,6 +143,10 @@ fn absolute_layout_start_top_end_bottom__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 ad31ec484..d55f4fb1d 100644 --- a/tests/generated/flex/absolute_layout_width_height_end_bottom.rs +++ b/tests/generated/flex/absolute_layout_width_height_end_bottom.rs @@ -7,6 +7,7 @@ fn absolute_layout_width_height_end_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -18,6 +19,10 @@ fn absolute_layout_width_height_end_bottom__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_width_height_end_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -135,6 +141,10 @@ fn absolute_layout_width_height_end_bottom__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 349500206..119baba5f 100644 --- a/tests/generated/flex/absolute_layout_width_height_start_top.rs +++ b/tests/generated/flex/absolute_layout_width_height_start_top.rs @@ -7,6 +7,7 @@ fn absolute_layout_width_height_start_top__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -18,6 +19,10 @@ fn absolute_layout_width_height_start_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn absolute_layout_width_height_start_top__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -135,6 +141,10 @@ fn absolute_layout_width_height_start_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 1cff15f44..99767266d 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 @@ -7,6 +7,7 @@ fn absolute_layout_width_height_start_top_end_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -23,6 +24,10 @@ fn absolute_layout_width_height_start_top_end_bottom__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -128,6 +133,7 @@ fn absolute_layout_width_height_start_top_end_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -145,6 +151,10 @@ fn absolute_layout_width_height_start_top_end_bottom__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/absolute_layout_within_border.rs b/tests/generated/flex/absolute_layout_within_border.rs index 76affcc95..22885853b 100644 --- a/tests/generated/flex/absolute_layout_within_border.rs +++ b/tests/generated/flex/absolute_layout_within_border.rs @@ -7,6 +7,7 @@ fn absolute_layout_within_border__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,7 @@ fn absolute_layout_within_border__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -29,6 +31,7 @@ fn absolute_layout_within_border__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -46,6 +49,7 @@ fn absolute_layout_within_border__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -63,6 +67,10 @@ fn absolute_layout_within_border__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -297,6 +305,7 @@ fn absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -309,6 +318,7 @@ fn absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -321,6 +331,7 @@ fn absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -339,6 +350,7 @@ fn absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -357,6 +369,10 @@ fn absolute_layout_within_border__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/absolute_margin_bottom_left.rs b/tests/generated/flex/absolute_margin_bottom_left.rs index d05ed159b..b8501cd0d 100644 --- a/tests/generated/flex/absolute_margin_bottom_left.rs +++ b/tests/generated/flex/absolute_margin_bottom_left.rs @@ -7,6 +7,7 @@ fn absolute_margin_bottom_left__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -19,6 +20,10 @@ fn absolute_margin_bottom_left__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn absolute_margin_bottom_left__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -138,6 +144,10 @@ fn absolute_margin_bottom_left__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/absolute_minmax_bottom_right_max.rs b/tests/generated/flex/absolute_minmax_bottom_right_max.rs index 4719a810b..d31319f1b 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_max.rs @@ -7,6 +7,7 @@ fn absolute_minmax_bottom_right_max__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -22,6 +23,10 @@ fn absolute_minmax_bottom_right_max__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -127,6 +132,7 @@ fn absolute_minmax_bottom_right_max__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -143,6 +149,10 @@ fn absolute_minmax_bottom_right_max__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 6d998b0e5..30e5ada8e 100644 --- a/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs +++ b/tests/generated/flex/absolute_minmax_bottom_right_min_max.rs @@ -7,6 +7,7 @@ fn absolute_minmax_bottom_right_min_max__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -22,6 +23,10 @@ fn absolute_minmax_bottom_right_min_max__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -127,6 +132,7 @@ fn absolute_minmax_bottom_right_min_max__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -143,6 +149,10 @@ fn absolute_minmax_bottom_right_min_max__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 0753b4775..dcced8151 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 @@ -7,6 +7,7 @@ fn absolute_minmax_bottom_right_min_max_preferred__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -26,6 +27,10 @@ fn absolute_minmax_bottom_right_min_max_preferred__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -131,6 +136,7 @@ fn absolute_minmax_bottom_right_min_max_preferred__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -151,6 +157,10 @@ fn absolute_minmax_bottom_right_min_max_preferred__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 df31a06b4..0278adeb9 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 @@ -7,6 +7,7 @@ fn absolute_minmax_top_left_bottom_right_max__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(30f32), @@ -23,6 +24,10 @@ fn absolute_minmax_top_left_bottom_right_max__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -128,6 +133,7 @@ fn absolute_minmax_top_left_bottom_right_max__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(30f32), @@ -145,6 +151,10 @@ fn absolute_minmax_top_left_bottom_right_max__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 18b352c44..9672e5399 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 @@ -7,6 +7,7 @@ fn absolute_minmax_top_left_bottom_right_min_max__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -27,6 +28,10 @@ fn absolute_minmax_top_left_bottom_right_min_max__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -132,6 +137,7 @@ fn absolute_minmax_top_left_bottom_right_min_max__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -153,6 +159,10 @@ fn absolute_minmax_top_left_bottom_right_min_max__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 2ed96c2f4..376686af7 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_max_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_max_size.rs @@ -7,6 +7,7 @@ fn absolute_padding_border_overrides_max_size__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -26,7 +27,18 @@ fn absolute_padding_border_overrides_max_size__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -123,6 +135,7 @@ fn absolute_padding_border_overrides_max_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -144,7 +157,14 @@ fn absolute_padding_border_overrides_max_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/absolute_padding_border_overrides_size.rs b/tests/generated/flex/absolute_padding_border_overrides_size.rs index 640fad247..96cfed441 100644 --- a/tests/generated/flex/absolute_padding_border_overrides_size.rs +++ b/tests/generated/flex/absolute_padding_border_overrides_size.rs @@ -7,6 +7,7 @@ fn absolute_padding_border_overrides_size__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -26,7 +27,18 @@ fn absolute_padding_border_overrides_size__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -123,6 +135,7 @@ fn absolute_padding_border_overrides_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -144,7 +157,14 @@ fn absolute_padding_border_overrides_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/absolute_resolved_insets.rs b/tests/generated/flex/absolute_resolved_insets.rs index b4807a548..8a7e8b50d 100644 --- a/tests/generated/flex/absolute_resolved_insets.rs +++ b/tests/generated/flex/absolute_resolved_insets.rs @@ -7,6 +7,7 @@ fn absolute_resolved_insets__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -19,6 +20,7 @@ fn absolute_resolved_insets__border_box() { let node01 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -26,6 +28,7 @@ fn absolute_resolved_insets__border_box() { let node02 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -33,6 +36,7 @@ fn absolute_resolved_insets__border_box() { let node03 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -40,6 +44,7 @@ fn absolute_resolved_insets__border_box() { let node04 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -47,6 +52,7 @@ fn absolute_resolved_insets__border_box() { let node05 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -59,6 +65,10 @@ fn absolute_resolved_insets__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -83,6 +93,7 @@ fn absolute_resolved_insets__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -95,6 +106,7 @@ fn absolute_resolved_insets__border_box() { let node11 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -102,6 +114,7 @@ fn absolute_resolved_insets__border_box() { let node12 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -109,6 +122,7 @@ fn absolute_resolved_insets__border_box() { let node13 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -116,6 +130,7 @@ fn absolute_resolved_insets__border_box() { let node14 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -123,6 +138,7 @@ fn absolute_resolved_insets__border_box() { let node15 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -161,7 +177,18 @@ fn absolute_resolved_insets__border_box() { &[node10, node11, node12, node13, node14, node15], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -789,6 +816,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -802,6 +830,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -810,6 +839,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -818,6 +848,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -826,6 +857,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -834,6 +866,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -847,6 +880,10 @@ fn absolute_resolved_insets__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -872,6 +909,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -885,6 +923,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -893,6 +932,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -901,6 +941,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -909,6 +950,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -917,6 +959,7 @@ fn absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -958,7 +1001,14 @@ fn absolute_resolved_insets__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); diff --git a/tests/generated/flex/align_baseline.rs b/tests/generated/flex/align_baseline.rs index cf08125b5..0c45a45d1 100644 --- a/tests/generated/flex/align_baseline.rs +++ b/tests/generated/flex/align_baseline.rs @@ -6,6 +6,7 @@ fn align_baseline__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -25,6 +27,10 @@ fn align_baseline__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -169,6 +175,7 @@ fn align_baseline__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -179,6 +186,7 @@ fn align_baseline__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -190,6 +198,10 @@ fn align_baseline__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child.rs b/tests/generated/flex/align_baseline_child.rs index 24306cfe8..4550d5e21 100644 --- a/tests/generated/flex/align_baseline_child.rs +++ b/tests/generated/flex/align_baseline_child.rs @@ -6,6 +6,7 @@ fn align_baseline_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_child__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_baseline_child__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -38,6 +44,10 @@ fn align_baseline_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -227,6 +237,7 @@ fn align_baseline_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -237,6 +248,7 @@ fn align_baseline_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -249,6 +261,10 @@ fn align_baseline_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -262,6 +278,10 @@ fn align_baseline_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_margin.rs b/tests/generated/flex/align_baseline_child_margin.rs index 3880fa3a1..c3437bec9 100644 --- a/tests/generated/flex/align_baseline_child_margin.rs +++ b/tests/generated/flex/align_baseline_child_margin.rs @@ -6,6 +6,7 @@ fn align_baseline_child_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn align_baseline_child_margin__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -38,6 +40,10 @@ fn align_baseline_child_margin__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -50,6 +56,10 @@ fn align_baseline_child_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -239,6 +249,7 @@ fn align_baseline_child_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -255,6 +266,7 @@ fn align_baseline_child_margin__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -273,6 +285,10 @@ fn align_baseline_child_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -286,6 +302,10 @@ fn align_baseline_child_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_margin_percent.rs b/tests/generated/flex/align_baseline_child_margin_percent.rs index 773d9e985..d59dfb790 100644 --- a/tests/generated/flex/align_baseline_child_margin_percent.rs +++ b/tests/generated/flex/align_baseline_child_margin_percent.rs @@ -6,6 +6,7 @@ fn align_baseline_child_margin_percent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn align_baseline_child_margin_percent__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -38,6 +40,10 @@ fn align_baseline_child_margin_percent__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -50,6 +56,10 @@ fn align_baseline_child_margin_percent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -239,6 +249,7 @@ fn align_baseline_child_margin_percent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -255,6 +266,7 @@ fn align_baseline_child_margin_percent__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -273,6 +285,10 @@ fn align_baseline_child_margin_percent__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -286,6 +302,10 @@ fn align_baseline_child_margin_percent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_multiline.rs b/tests/generated/flex/align_baseline_child_multiline.rs index 01f735861..9db8a372d 100644 --- a/tests/generated/flex/align_baseline_child_multiline.rs +++ b/tests/generated/flex/align_baseline_child_multiline.rs @@ -6,6 +6,7 @@ fn align_baseline_child_multiline__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -15,6 +16,7 @@ fn align_baseline_child_multiline__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn align_baseline_child_multiline__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_baseline_child_multiline__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn align_baseline_child_multiline__border_box() { .unwrap(); let node13 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -53,6 +58,10 @@ fn align_baseline_child_multiline__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -62,6 +71,10 @@ fn align_baseline_child_multiline__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -383,6 +396,7 @@ fn align_baseline_child_multiline__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -393,6 +407,7 @@ fn align_baseline_child_multiline__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +418,7 @@ fn align_baseline_child_multiline__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -413,6 +429,7 @@ fn align_baseline_child_multiline__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -423,6 +440,7 @@ fn align_baseline_child_multiline__content_box() { let node13 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -435,6 +453,10 @@ fn align_baseline_child_multiline__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -445,6 +467,10 @@ fn align_baseline_child_multiline__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 dce49ea55..76229dc64 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 @@ -6,6 +6,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -15,6 +16,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { .unwrap(); let node13 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -54,6 +59,10 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(25f32), @@ -66,6 +75,10 @@ fn align_baseline_child_multiline_no_override_on_secondline__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -390,6 +403,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -400,6 +414,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -410,6 +425,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -420,6 +436,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -430,6 +447,7 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { let node13 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -443,6 +461,10 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(25f32), @@ -456,6 +478,10 @@ fn align_baseline_child_multiline_no_override_on_secondline__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_multiline_override.rs b/tests/generated/flex/align_baseline_child_multiline_override.rs index 03d0d2a03..596c292c6 100644 --- a/tests/generated/flex/align_baseline_child_multiline_override.rs +++ b/tests/generated/flex/align_baseline_child_multiline_override.rs @@ -6,6 +6,7 @@ fn align_baseline_child_multiline_override__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -15,6 +16,7 @@ fn align_baseline_child_multiline_override__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn align_baseline_child_multiline_override__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -34,6 +37,7 @@ fn align_baseline_child_multiline_override__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -43,6 +47,7 @@ fn align_baseline_child_multiline_override__border_box() { .unwrap(); let node13 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -55,6 +60,10 @@ fn align_baseline_child_multiline_override__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(25f32), @@ -67,6 +76,10 @@ fn align_baseline_child_multiline_override__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -391,6 +404,7 @@ fn align_baseline_child_multiline_override__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -401,6 +415,7 @@ fn align_baseline_child_multiline_override__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -411,6 +426,7 @@ fn align_baseline_child_multiline_override__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -422,6 +438,7 @@ fn align_baseline_child_multiline_override__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -432,6 +449,7 @@ fn align_baseline_child_multiline_override__content_box() { let node13 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -445,6 +463,10 @@ fn align_baseline_child_multiline_override__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(25f32), @@ -458,6 +480,10 @@ fn align_baseline_child_multiline_override__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_padding.rs b/tests/generated/flex/align_baseline_child_padding.rs index 58c9787b0..5d5bec3dd 100644 --- a/tests/generated/flex/align_baseline_child_padding.rs +++ b/tests/generated/flex/align_baseline_child_padding.rs @@ -6,6 +6,7 @@ fn align_baseline_child_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_child_padding__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_baseline_child_padding__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -44,6 +50,10 @@ fn align_baseline_child_padding__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -239,6 +249,7 @@ fn align_baseline_child_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -249,6 +260,7 @@ fn align_baseline_child_padding__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -261,6 +273,10 @@ fn align_baseline_child_padding__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -280,6 +296,10 @@ fn align_baseline_child_padding__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_top.rs b/tests/generated/flex/align_baseline_child_top.rs index 31695b567..abd54482f 100644 --- a/tests/generated/flex/align_baseline_child_top.rs +++ b/tests/generated/flex/align_baseline_child_top.rs @@ -6,6 +6,7 @@ fn align_baseline_child_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -16,6 +17,7 @@ fn align_baseline_child_top__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,6 +29,10 @@ fn align_baseline_child_top__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -39,6 +45,10 @@ fn align_baseline_child_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -228,6 +238,7 @@ fn align_baseline_child_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -239,6 +250,7 @@ fn align_baseline_child_top__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -251,6 +263,10 @@ fn align_baseline_child_top__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -264,6 +280,10 @@ fn align_baseline_child_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_child_top2.rs b/tests/generated/flex/align_baseline_child_top2.rs index e50ab03d4..6d1311f33 100644 --- a/tests/generated/flex/align_baseline_child_top2.rs +++ b/tests/generated/flex/align_baseline_child_top2.rs @@ -6,6 +6,7 @@ fn align_baseline_child_top2__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_child_top2__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -25,6 +27,10 @@ fn align_baseline_child_top2__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -38,6 +44,10 @@ fn align_baseline_child_top2__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -227,6 +237,7 @@ fn align_baseline_child_top2__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -237,6 +248,7 @@ fn align_baseline_child_top2__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -248,6 +260,10 @@ fn align_baseline_child_top2__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -262,6 +278,10 @@ fn align_baseline_child_top2__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_column.rs b/tests/generated/flex/align_baseline_column.rs index fa63b806c..51848b8a1 100644 --- a/tests/generated/flex/align_baseline_column.rs +++ b/tests/generated/flex/align_baseline_column.rs @@ -6,6 +6,7 @@ fn align_baseline_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,10 @@ fn align_baseline_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -170,6 +176,7 @@ fn align_baseline_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -180,6 +187,7 @@ fn align_baseline_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -192,6 +200,10 @@ fn align_baseline_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_double_nested_child.rs b/tests/generated/flex/align_baseline_double_nested_child.rs index 86cebb9a3..1ba9123e8 100644 --- a/tests/generated/flex/align_baseline_double_nested_child.rs +++ b/tests/generated/flex/align_baseline_double_nested_child.rs @@ -6,6 +6,7 @@ fn align_baseline_double_nested_child__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,10 @@ fn align_baseline_double_nested_child__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -27,6 +32,7 @@ fn align_baseline_double_nested_child__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -37,6 +43,10 @@ fn align_baseline_double_nested_child__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -49,6 +59,10 @@ fn align_baseline_double_nested_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -283,6 +297,7 @@ fn align_baseline_double_nested_child__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -294,6 +309,10 @@ fn align_baseline_double_nested_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -306,6 +325,7 @@ fn align_baseline_double_nested_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -317,6 +337,10 @@ fn align_baseline_double_nested_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -330,6 +354,10 @@ fn align_baseline_double_nested_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_multiline.rs b/tests/generated/flex/align_baseline_multiline.rs index 8b9b239f0..ab2961dea 100644 --- a/tests/generated/flex/align_baseline_multiline.rs +++ b/tests/generated/flex/align_baseline_multiline.rs @@ -6,6 +6,7 @@ fn align_baseline_multiline__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_multiline__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -37,6 +43,7 @@ fn align_baseline_multiline__border_box() { .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -48,6 +55,10 @@ fn align_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -59,6 +70,7 @@ fn align_baseline_multiline__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -70,6 +82,10 @@ fn align_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -382,6 +398,7 @@ fn align_baseline_multiline__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -392,6 +409,7 @@ fn align_baseline_multiline__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -404,6 +422,10 @@ fn align_baseline_multiline__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -416,6 +438,7 @@ fn align_baseline_multiline__content_box() { let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -428,6 +451,10 @@ fn align_baseline_multiline__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -440,6 +467,7 @@ fn align_baseline_multiline__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -452,6 +480,10 @@ fn align_baseline_multiline__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_multiline_column.rs b/tests/generated/flex/align_baseline_multiline_column.rs index d43dd8d82..41233bba6 100644 --- a/tests/generated/flex/align_baseline_multiline_column.rs +++ b/tests/generated/flex/align_baseline_multiline_column.rs @@ -6,6 +6,7 @@ fn align_baseline_multiline_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_multiline_column__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,10 @@ fn align_baseline_multiline_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -37,6 +43,7 @@ fn align_baseline_multiline_column__border_box() { .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -48,6 +55,10 @@ fn align_baseline_multiline_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -59,6 +70,7 @@ fn align_baseline_multiline_column__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -71,6 +83,10 @@ fn align_baseline_multiline_column__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -383,6 +399,7 @@ fn align_baseline_multiline_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -393,6 +410,7 @@ fn align_baseline_multiline_column__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -405,6 +423,10 @@ fn align_baseline_multiline_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -417,6 +439,7 @@ fn align_baseline_multiline_column__content_box() { let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -429,6 +452,10 @@ fn align_baseline_multiline_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -441,6 +468,7 @@ fn align_baseline_multiline_column__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -454,6 +482,10 @@ fn align_baseline_multiline_column__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_multiline_column2.rs b/tests/generated/flex/align_baseline_multiline_column2.rs index 9a191f249..e5608af8c 100644 --- a/tests/generated/flex/align_baseline_multiline_column2.rs +++ b/tests/generated/flex/align_baseline_multiline_column2.rs @@ -7,6 +7,7 @@ fn align_baseline_multiline_column2__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn align_baseline_multiline_column2__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -28,6 +30,10 @@ fn align_baseline_multiline_column2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -40,6 +46,7 @@ fn align_baseline_multiline_column2__border_box() { let node20 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +58,10 @@ fn align_baseline_multiline_column2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -63,6 +74,7 @@ fn align_baseline_multiline_column2__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -75,6 +87,10 @@ fn align_baseline_multiline_column2__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -388,6 +404,7 @@ fn align_baseline_multiline_column2__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -399,6 +416,7 @@ fn align_baseline_multiline_column2__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -411,6 +429,10 @@ fn align_baseline_multiline_column2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -424,6 +446,7 @@ fn align_baseline_multiline_column2__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -436,6 +459,10 @@ fn align_baseline_multiline_column2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -449,6 +476,7 @@ fn align_baseline_multiline_column2__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -462,6 +490,10 @@ fn align_baseline_multiline_column2__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 992bd7b9a..946fcd12b 100644 --- a/tests/generated/flex/align_baseline_multiline_row_and_column.rs +++ b/tests/generated/flex/align_baseline_multiline_row_and_column.rs @@ -6,6 +6,7 @@ fn align_baseline_multiline_row_and_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_multiline_row_and_column__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -37,6 +43,7 @@ fn align_baseline_multiline_row_and_column__border_box() { .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -48,6 +55,10 @@ fn align_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -59,6 +70,7 @@ fn align_baseline_multiline_row_and_column__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -70,6 +82,10 @@ fn align_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -382,6 +398,7 @@ fn align_baseline_multiline_row_and_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -392,6 +409,7 @@ fn align_baseline_multiline_row_and_column__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -404,6 +422,10 @@ fn align_baseline_multiline_row_and_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -416,6 +438,7 @@ fn align_baseline_multiline_row_and_column__content_box() { let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -428,6 +451,10 @@ fn align_baseline_multiline_row_and_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -440,6 +467,7 @@ fn align_baseline_multiline_row_and_column__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -452,6 +480,10 @@ fn align_baseline_multiline_row_and_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_nested_child.rs b/tests/generated/flex/align_baseline_nested_child.rs index 3f52da16e..58973ee9c 100644 --- a/tests/generated/flex/align_baseline_nested_child.rs +++ b/tests/generated/flex/align_baseline_nested_child.rs @@ -6,6 +6,7 @@ fn align_baseline_nested_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_baseline_nested_child__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_baseline_nested_child__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -38,6 +44,10 @@ fn align_baseline_nested_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -227,6 +237,7 @@ fn align_baseline_nested_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -237,6 +248,7 @@ fn align_baseline_nested_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -249,6 +261,10 @@ fn align_baseline_nested_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -262,6 +278,10 @@ fn align_baseline_nested_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_baseline_nested_column.rs b/tests/generated/flex/align_baseline_nested_column.rs index 010ede6cd..9bf0aeb62 100644 --- a/tests/generated/flex/align_baseline_nested_column.rs +++ b/tests/generated/flex/align_baseline_nested_column.rs @@ -6,6 +6,7 @@ fn align_baseline_nested_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -16,6 +17,7 @@ fn align_baseline_nested_column__border_box() { let node100 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(30f32), @@ -26,6 +28,7 @@ fn align_baseline_nested_column__border_box() { let node101 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(40f32), @@ -37,6 +40,10 @@ fn align_baseline_nested_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(80f32), @@ -48,13 +55,24 @@ fn align_baseline_nested_column__border_box() { .unwrap(); let node1 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node10], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -334,6 +352,7 @@ fn align_baseline_nested_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -345,6 +364,7 @@ fn align_baseline_nested_column__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(30f32), @@ -356,6 +376,7 @@ fn align_baseline_nested_column__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(40f32), @@ -368,6 +389,10 @@ fn align_baseline_nested_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(80f32), @@ -382,6 +407,10 @@ fn align_baseline_nested_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node10], @@ -391,6 +420,10 @@ fn align_baseline_nested_column__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 12fa18cf2..aab80b056 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 @@ -6,6 +6,7 @@ fn align_center_should_size_based_on_content__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -14,11 +15,26 @@ fn align_center_should_size_based_on_content__border_box() { }) .unwrap(); let node00 = taffy - .new_with_children(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }, &[node000]) + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }, + &[node000], + ) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), flex_grow: 0f32, flex_shrink: 1f32, @@ -30,6 +46,10 @@ fn align_center_should_size_based_on_content__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -225,6 +245,7 @@ fn align_center_should_size_based_on_content__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -236,6 +257,10 @@ fn align_center_should_size_based_on_content__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -247,6 +272,10 @@ fn align_center_should_size_based_on_content__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), flex_grow: 0f32, flex_shrink: 1f32, @@ -259,6 +288,10 @@ fn align_center_should_size_based_on_content__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_content_center_single_line.rs b/tests/generated/flex/align_content_center_single_line.rs index 61bf05fe7..2ddcb997f 100644 --- a/tests/generated/flex/align_content_center_single_line.rs +++ b/tests/generated/flex/align_content_center_single_line.rs @@ -6,6 +6,7 @@ fn align_content_center_single_line__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_center_single_line__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_center_single_line__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_center_single_line__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_center_single_line__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_center_single_line__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -61,6 +67,10 @@ fn align_content_center_single_line__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), @@ -361,6 +371,7 @@ fn align_content_center_single_line__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -371,6 +382,7 @@ fn align_content_center_single_line__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -381,6 +393,7 @@ fn align_content_center_single_line__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -391,6 +404,7 @@ fn align_content_center_single_line__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -401,6 +415,7 @@ fn align_content_center_single_line__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +426,7 @@ fn align_content_center_single_line__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -422,6 +438,10 @@ fn align_content_center_single_line__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), 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 ed8caccdb..1fb225a1e 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 @@ -6,6 +6,7 @@ fn align_content_center_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_center_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_center_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_center_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_center_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_center_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 67ca3aa22..9e203588b 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 @@ -6,6 +6,7 @@ fn align_content_center_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_center_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_center_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_center_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_center_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_center_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_center_wrapped.rs b/tests/generated/flex/align_content_center_wrapped.rs index 60c2809bf..786e481fe 100644 --- a/tests/generated/flex/align_content_center_wrapped.rs +++ b/tests/generated/flex/align_content_center_wrapped.rs @@ -6,6 +6,7 @@ fn align_content_center_wrapped__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_center_wrapped__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_center_wrapped__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_center_wrapped__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_center_wrapped__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_center_wrapped__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -62,6 +68,10 @@ fn align_content_center_wrapped__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), @@ -362,6 +372,7 @@ fn align_content_center_wrapped__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -372,6 +383,7 @@ fn align_content_center_wrapped__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -382,6 +394,7 @@ fn align_content_center_wrapped__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -392,6 +405,7 @@ fn align_content_center_wrapped__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -402,6 +416,7 @@ fn align_content_center_wrapped__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -412,6 +427,7 @@ fn align_content_center_wrapped__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -424,6 +440,10 @@ fn align_content_center_wrapped__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), 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 7c1dddafa..00786398a 100644 --- a/tests/generated/flex/align_content_center_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_center_wrapped_negative_space.rs @@ -6,6 +6,7 @@ fn align_content_center_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_center_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_center_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_center_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_center_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_center_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_center_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_center_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_center_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_center_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 e9fe1c4f9..53c247720 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 @@ -6,6 +6,7 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn align_content_center_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn align_content_center_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_end.rs b/tests/generated/flex/align_content_end.rs index 2d5a65661..023ad5fdb 100644 --- a/tests/generated/flex/align_content_end.rs +++ b/tests/generated/flex/align_content_end.rs @@ -6,6 +6,7 @@ fn align_content_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_end__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_end__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_end__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -54,6 +59,10 @@ fn align_content_end__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -315,6 +324,7 @@ fn align_content_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -325,6 +335,7 @@ fn align_content_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -335,6 +346,7 @@ fn align_content_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -345,6 +357,7 @@ fn align_content_end__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -355,6 +368,7 @@ fn align_content_end__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -368,6 +382,10 @@ fn align_content_end__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 c2a9afba3..09005d3dc 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 @@ -6,6 +6,7 @@ fn align_content_end_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_end_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_end_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_end_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_end_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_end_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 126a8b153..96acd3192 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 @@ -6,6 +6,7 @@ fn align_content_end_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_end_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_end_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_end_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_end_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_end_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 c895b2d73..b8823d3aa 100644 --- a/tests/generated/flex/align_content_end_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_end_wrapped_negative_space.rs @@ -6,6 +6,7 @@ fn align_content_end_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_end_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_end_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_end_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_end_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_end_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_end_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_end_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_end_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_end_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 352b52bf0..f809bc77b 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 @@ -6,6 +6,7 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn align_content_end_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn align_content_end_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_flex_end.rs b/tests/generated/flex/align_content_flex_end.rs index 7f52aeeb9..f8b072712 100644 --- a/tests/generated/flex/align_content_flex_end.rs +++ b/tests/generated/flex/align_content_flex_end.rs @@ -6,6 +6,7 @@ fn align_content_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_flex_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_flex_end__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_flex_end__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_flex_end__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -54,6 +59,10 @@ fn align_content_flex_end__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -315,6 +324,7 @@ fn align_content_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -325,6 +335,7 @@ fn align_content_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -335,6 +346,7 @@ fn align_content_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -345,6 +357,7 @@ fn align_content_flex_end__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -355,6 +368,7 @@ fn align_content_flex_end__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -368,6 +382,10 @@ fn align_content_flex_end__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_content_flex_start.rs b/tests/generated/flex/align_content_flex_start.rs index 2361b4cdd..e3a2cc397 100644 --- a/tests/generated/flex/align_content_flex_start.rs +++ b/tests/generated/flex/align_content_flex_start.rs @@ -6,6 +6,7 @@ fn align_content_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_flex_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_flex_start__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_flex_start__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_flex_start__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -53,6 +58,10 @@ fn align_content_flex_start__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), @@ -314,6 +323,7 @@ fn align_content_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -324,6 +334,7 @@ fn align_content_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -334,6 +345,7 @@ fn align_content_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -344,6 +356,7 @@ fn align_content_flex_start__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -354,6 +367,7 @@ fn align_content_flex_start__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -366,6 +380,10 @@ fn align_content_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), 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 ecbe663e2..ea9634df9 100644 --- a/tests/generated/flex/align_content_flex_start_with_flex.rs +++ b/tests/generated/flex/align_content_flex_start_with_flex.rs @@ -6,6 +6,7 @@ fn align_content_flex_start_with_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -15,6 +16,7 @@ fn align_content_flex_start_with_flex__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -27,12 +29,14 @@ fn align_content_flex_start_with_flex__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -42,6 +46,7 @@ fn align_content_flex_start_with_flex__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -51,6 +56,10 @@ fn align_content_flex_start_with_flex__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -312,6 +321,7 @@ fn align_content_flex_start_with_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -322,6 +332,7 @@ fn align_content_flex_start_with_flex__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -335,6 +346,7 @@ fn align_content_flex_start_with_flex__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -342,6 +354,7 @@ fn align_content_flex_start_with_flex__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -352,6 +365,7 @@ fn align_content_flex_start_with_flex__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -362,6 +376,10 @@ fn align_content_flex_start_with_flex__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 e0713e442..765c029be 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 @@ -6,12 +6,14 @@ fn align_content_flex_start_without_height_on_children__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,12 +23,14 @@ fn align_content_flex_start_without_height_on_children__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -36,6 +40,7 @@ fn align_content_flex_start_without_height_on_children__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -45,6 +50,10 @@ fn align_content_flex_start_without_height_on_children__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -306,6 +315,7 @@ fn align_content_flex_start_without_height_on_children__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -313,6 +323,7 @@ fn align_content_flex_start_without_height_on_children__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -323,6 +334,7 @@ fn align_content_flex_start_without_height_on_children__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -330,6 +342,7 @@ fn align_content_flex_start_without_height_on_children__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -340,6 +353,7 @@ fn align_content_flex_start_without_height_on_children__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -350,6 +364,10 @@ fn align_content_flex_start_without_height_on_children__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 86fd4d217..d0c35b864 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 @@ -6,6 +6,7 @@ fn align_content_not_stretch_with_align_items_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(272f32), height: taffy::style::Dimension::from_length(44f32), @@ -15,12 +16,20 @@ fn align_content_not_stretch_with_align_items_stretch__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(56f32), height: taffy::style::Dimension::from_length(44f32), @@ -30,7 +39,14 @@ fn align_content_not_stretch_with_align_items_stretch__border_box() { .unwrap(); let node1 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node10], ) .unwrap(); @@ -38,6 +54,10 @@ fn align_content_not_stretch_with_align_items_stretch__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(328f32), @@ -272,6 +292,7 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(272f32), height: taffy::style::Dimension::from_length(44f32), @@ -284,6 +305,10 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -292,6 +317,7 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(56f32), height: taffy::style::Dimension::from_length(44f32), @@ -304,6 +330,10 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node10], @@ -314,6 +344,10 @@ fn align_content_not_stretch_with_align_items_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(328f32), 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 f3cb52ebc..7e2b301d2 100644 --- a/tests/generated/flex/align_content_space_around_single_line.rs +++ b/tests/generated/flex/align_content_space_around_single_line.rs @@ -6,6 +6,7 @@ fn align_content_space_around_single_line__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_around_single_line__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_around_single_line__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_around_single_line__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_around_single_line__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_around_single_line__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -61,6 +67,10 @@ fn align_content_space_around_single_line__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -361,6 +371,7 @@ fn align_content_space_around_single_line__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -371,6 +382,7 @@ fn align_content_space_around_single_line__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -381,6 +393,7 @@ fn align_content_space_around_single_line__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -391,6 +404,7 @@ fn align_content_space_around_single_line__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -401,6 +415,7 @@ fn align_content_space_around_single_line__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +426,7 @@ fn align_content_space_around_single_line__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -422,6 +438,10 @@ fn align_content_space_around_single_line__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 9a546f0d2..af09ec015 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 @@ -6,6 +6,7 @@ fn align_content_space_around_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_around_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_space_around_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_space_around_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_space_around_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_space_around_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 61e147936..872e5d931 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 @@ -6,6 +6,7 @@ fn align_content_space_around_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_around_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_space_around_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_space_around_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_space_around_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_space_around_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_around_wrapped.rs b/tests/generated/flex/align_content_space_around_wrapped.rs index 2fe9693da..abf96085c 100644 --- a/tests/generated/flex/align_content_space_around_wrapped.rs +++ b/tests/generated/flex/align_content_space_around_wrapped.rs @@ -6,6 +6,7 @@ fn align_content_space_around_wrapped__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_around_wrapped__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_around_wrapped__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_around_wrapped__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_around_wrapped__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_around_wrapped__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -62,6 +68,10 @@ fn align_content_space_around_wrapped__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -362,6 +372,7 @@ fn align_content_space_around_wrapped__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -372,6 +383,7 @@ fn align_content_space_around_wrapped__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -382,6 +394,7 @@ fn align_content_space_around_wrapped__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -392,6 +405,7 @@ fn align_content_space_around_wrapped__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -402,6 +416,7 @@ fn align_content_space_around_wrapped__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -412,6 +427,7 @@ fn align_content_space_around_wrapped__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -424,6 +440,10 @@ fn align_content_space_around_wrapped__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 c667aaadf..9f14dcc00 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 @@ -6,6 +6,7 @@ fn align_content_space_around_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_around_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_around_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_around_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_space_around_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_space_around_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_space_around_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_space_around_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_space_around_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_space_around_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 2b8b4f609..03cf58998 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 @@ -6,6 +6,7 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn align_content_space_around_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn align_content_space_around_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_around_wrapped_single.rs b/tests/generated/flex/align_content_space_around_wrapped_single.rs index 7d06a1f0b..5ab770f8f 100644 --- a/tests/generated/flex/align_content_space_around_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_around_wrapped_single.rs @@ -6,6 +6,7 @@ fn align_content_space_around_wrapped_single__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_content_space_around_wrapped_single__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_content_space_around_wrapped_single__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_content_space_around_wrapped_single__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 bac532d82..f64791baf 100644 --- a/tests/generated/flex/align_content_space_between_single_line.rs +++ b/tests/generated/flex/align_content_space_between_single_line.rs @@ -6,6 +6,7 @@ fn align_content_space_between_single_line__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_between_single_line__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_between_single_line__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_between_single_line__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_between_single_line__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_between_single_line__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -61,6 +67,10 @@ fn align_content_space_between_single_line__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -361,6 +371,7 @@ fn align_content_space_between_single_line__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -371,6 +382,7 @@ fn align_content_space_between_single_line__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -381,6 +393,7 @@ fn align_content_space_between_single_line__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -391,6 +404,7 @@ fn align_content_space_between_single_line__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -401,6 +415,7 @@ fn align_content_space_between_single_line__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +426,7 @@ fn align_content_space_between_single_line__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -422,6 +438,10 @@ fn align_content_space_between_single_line__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 a6fbb3422..3eeb20311 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 @@ -6,6 +6,7 @@ fn align_content_space_between_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_between_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_space_between_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_space_between_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_space_between_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_space_between_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 950054178..1464089c2 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 @@ -6,6 +6,7 @@ fn align_content_space_between_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_between_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_space_between_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_space_between_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_space_between_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_space_between_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_between_wrapped.rs b/tests/generated/flex/align_content_space_between_wrapped.rs index 406403734..2a286767d 100644 --- a/tests/generated/flex/align_content_space_between_wrapped.rs +++ b/tests/generated/flex/align_content_space_between_wrapped.rs @@ -6,6 +6,7 @@ fn align_content_space_between_wrapped__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_between_wrapped__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_between_wrapped__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_between_wrapped__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_between_wrapped__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_between_wrapped__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -62,6 +68,10 @@ fn align_content_space_between_wrapped__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -362,6 +372,7 @@ fn align_content_space_between_wrapped__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -372,6 +383,7 @@ fn align_content_space_between_wrapped__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -382,6 +394,7 @@ fn align_content_space_between_wrapped__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -392,6 +405,7 @@ fn align_content_space_between_wrapped__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -402,6 +416,7 @@ fn align_content_space_between_wrapped__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -412,6 +427,7 @@ fn align_content_space_between_wrapped__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -424,6 +440,10 @@ fn align_content_space_between_wrapped__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 a654221f9..ad6babb33 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 @@ -6,6 +6,7 @@ fn align_content_space_between_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_between_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_between_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_between_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_space_between_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_space_between_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_space_between_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_space_between_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_space_between_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_space_between_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 c2453903f..f3c81bda6 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 @@ -6,6 +6,7 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn align_content_space_between_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn align_content_space_between_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_between_wrapped_single.rs b/tests/generated/flex/align_content_space_between_wrapped_single.rs index 4e8efed05..333d0d5b3 100644 --- a/tests/generated/flex/align_content_space_between_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_between_wrapped_single.rs @@ -6,6 +6,7 @@ fn align_content_space_between_wrapped_single__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_content_space_between_wrapped_single__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_content_space_between_wrapped_single__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_content_space_between_wrapped_single__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 69f6eae88..a10994f39 100644 --- a/tests/generated/flex/align_content_space_evenly_single_line.rs +++ b/tests/generated/flex/align_content_space_evenly_single_line.rs @@ -6,6 +6,7 @@ fn align_content_space_evenly_single_line__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_evenly_single_line__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_evenly_single_line__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_evenly_single_line__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_evenly_single_line__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_evenly_single_line__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -61,6 +67,10 @@ fn align_content_space_evenly_single_line__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -361,6 +371,7 @@ fn align_content_space_evenly_single_line__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -371,6 +382,7 @@ fn align_content_space_evenly_single_line__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -381,6 +393,7 @@ fn align_content_space_evenly_single_line__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -391,6 +404,7 @@ fn align_content_space_evenly_single_line__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -401,6 +415,7 @@ fn align_content_space_evenly_single_line__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +426,7 @@ fn align_content_space_evenly_single_line__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -422,6 +438,10 @@ fn align_content_space_evenly_single_line__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 3bc6f63a1..04e741a7e 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 @@ -6,6 +6,7 @@ fn align_content_space_evenly_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_evenly_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_space_evenly_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_space_evenly_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_space_evenly_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_space_evenly_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 7b4dfd514..6f8b59071 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 @@ -6,6 +6,7 @@ fn align_content_space_evenly_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_space_evenly_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_space_evenly_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_space_evenly_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_space_evenly_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_space_evenly_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_evenly_wrapped.rs b/tests/generated/flex/align_content_space_evenly_wrapped.rs index 315c5bd83..1c0c3ba85 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped.rs @@ -6,6 +6,7 @@ fn align_content_space_evenly_wrapped__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_space_evenly_wrapped__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_space_evenly_wrapped__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_space_evenly_wrapped__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_space_evenly_wrapped__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +56,7 @@ fn align_content_space_evenly_wrapped__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -62,6 +68,10 @@ fn align_content_space_evenly_wrapped__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -362,6 +372,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -372,6 +383,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -382,6 +394,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -392,6 +405,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -402,6 +416,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -412,6 +427,7 @@ fn align_content_space_evenly_wrapped__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -424,6 +440,10 @@ fn align_content_space_evenly_wrapped__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 b79b6419b..2b53f4921 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 @@ -6,6 +6,7 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_space_evenly_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_space_evenly_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 533624b6f..a7b39fe87 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 @@ -6,6 +6,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn align_content_space_evenly_wrapped_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn align_content_space_evenly_wrapped_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_space_evenly_wrapped_single.rs b/tests/generated/flex/align_content_space_evenly_wrapped_single.rs index 70f551ee2..9d0b9fb0f 100644 --- a/tests/generated/flex/align_content_space_evenly_wrapped_single.rs +++ b/tests/generated/flex/align_content_space_evenly_wrapped_single.rs @@ -6,6 +6,7 @@ fn align_content_space_evenly_wrapped_single__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_content_space_evenly_wrapped_single__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_content_space_evenly_wrapped_single__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_content_space_evenly_wrapped_single__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_content_spacearound.rs b/tests/generated/flex/align_content_spacearound.rs index 9110160af..c074054ec 100644 --- a/tests/generated/flex/align_content_spacearound.rs +++ b/tests/generated/flex/align_content_spacearound.rs @@ -6,6 +6,7 @@ fn align_content_spacearound__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_spacearound__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_spacearound__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_spacearound__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_spacearound__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -53,6 +58,10 @@ fn align_content_spacearound__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(140f32), @@ -314,6 +323,7 @@ fn align_content_spacearound__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -324,6 +334,7 @@ fn align_content_spacearound__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -334,6 +345,7 @@ fn align_content_spacearound__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -344,6 +356,7 @@ fn align_content_spacearound__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -354,6 +367,7 @@ fn align_content_spacearound__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -366,6 +380,10 @@ fn align_content_spacearound__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(140f32), diff --git a/tests/generated/flex/align_content_spacebetween.rs b/tests/generated/flex/align_content_spacebetween.rs index 7c3cf9fcc..361eb3c3e 100644 --- a/tests/generated/flex/align_content_spacebetween.rs +++ b/tests/generated/flex/align_content_spacebetween.rs @@ -6,6 +6,7 @@ fn align_content_spacebetween__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_spacebetween__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_spacebetween__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_spacebetween__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_spacebetween__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -53,6 +58,10 @@ fn align_content_spacebetween__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), @@ -314,6 +323,7 @@ fn align_content_spacebetween__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -324,6 +334,7 @@ fn align_content_spacebetween__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -334,6 +345,7 @@ fn align_content_spacebetween__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -344,6 +356,7 @@ fn align_content_spacebetween__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -354,6 +367,7 @@ fn align_content_spacebetween__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -366,6 +380,10 @@ fn align_content_spacebetween__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), diff --git a/tests/generated/flex/align_content_start.rs b/tests/generated/flex/align_content_start.rs index 889fe051c..d694e0dbc 100644 --- a/tests/generated/flex/align_content_start.rs +++ b/tests/generated/flex/align_content_start.rs @@ -6,6 +6,7 @@ fn align_content_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_content_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -24,6 +26,7 @@ fn align_content_start__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -33,6 +36,7 @@ fn align_content_start__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -42,6 +46,7 @@ fn align_content_start__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -53,6 +58,10 @@ fn align_content_start__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), @@ -314,6 +323,7 @@ fn align_content_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -324,6 +334,7 @@ fn align_content_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -334,6 +345,7 @@ fn align_content_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -344,6 +356,7 @@ fn align_content_start__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -354,6 +367,7 @@ fn align_content_start__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -366,6 +380,10 @@ fn align_content_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(130f32), 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 0bf8afe7f..1ca64cc00 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 @@ -6,6 +6,7 @@ fn align_content_start_single_line_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_start_single_line_negative_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -31,6 +36,10 @@ fn align_content_start_single_line_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -186,6 +195,7 @@ fn align_content_start_single_line_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -199,6 +209,10 @@ fn align_content_start_single_line_negative_space__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -213,6 +227,10 @@ fn align_content_start_single_line_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 44ea6a0fd..abd0478e7 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 @@ -6,6 +6,7 @@ fn align_content_start_single_line_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -18,6 +19,10 @@ fn align_content_start_single_line_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -32,6 +37,10 @@ fn align_content_start_single_line_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -187,6 +196,7 @@ fn align_content_start_single_line_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -200,6 +210,10 @@ fn align_content_start_single_line_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -215,6 +229,10 @@ fn align_content_start_single_line_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 055b2a057..47dab5f33 100644 --- a/tests/generated/flex/align_content_start_wrapped_negative_space.rs +++ b/tests/generated/flex/align_content_start_wrapped_negative_space.rs @@ -6,6 +6,7 @@ fn align_content_start_wrapped_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn align_content_start_wrapped_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn align_content_start_wrapped_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn align_content_start_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn align_content_start_wrapped_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn align_content_start_wrapped_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn align_content_start_wrapped_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn align_content_start_wrapped_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn align_content_start_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn align_content_start_wrapped_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/align_content_stretch.rs b/tests/generated/flex/align_content_stretch.rs index efe6f44b2..a9fc44cdd 100644 --- a/tests/generated/flex/align_content_stretch.rs +++ b/tests/generated/flex/align_content_stretch.rs @@ -6,30 +6,35 @@ fn align_content_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -39,6 +44,10 @@ fn align_content_stretch__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -300,6 +309,7 @@ fn align_content_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -307,6 +317,7 @@ fn align_content_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -314,6 +325,7 @@ fn align_content_stretch__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -321,6 +333,7 @@ fn align_content_stretch__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -328,6 +341,7 @@ fn align_content_stretch__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -338,6 +352,10 @@ fn align_content_stretch__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), diff --git a/tests/generated/flex/align_content_stretch_column.rs b/tests/generated/flex/align_content_stretch_column.rs index 78dea8845..b804d5b28 100644 --- a/tests/generated/flex/align_content_stretch_column.rs +++ b/tests/generated/flex/align_content_stretch_column.rs @@ -6,6 +6,7 @@ fn align_content_stretch_column__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -16,6 +17,10 @@ fn align_content_stretch_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, @@ -24,6 +29,7 @@ fn align_content_stretch_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -33,18 +39,21 @@ fn align_content_stretch_column__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -54,6 +63,10 @@ fn align_content_stretch_column__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -360,6 +373,7 @@ fn align_content_stretch_column__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -371,6 +385,10 @@ fn align_content_stretch_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, @@ -380,6 +398,7 @@ fn align_content_stretch_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -390,6 +409,7 @@ fn align_content_stretch_column__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -397,6 +417,7 @@ fn align_content_stretch_column__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -404,6 +425,7 @@ fn align_content_stretch_column__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -414,6 +436,10 @@ fn align_content_stretch_column__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 3440af1a2..7af8e9eab 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 @@ -6,6 +6,7 @@ fn align_content_stretch_is_not_overriding_align_items__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_content_stretch_is_not_overriding_align_items__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { @@ -30,7 +35,14 @@ fn align_content_stretch_is_not_overriding_align_items__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_content: Some(taffy::style::AlignContent::Stretch), + ..Default::default() + }, &[node0], ) .unwrap(); @@ -180,6 +192,7 @@ fn align_content_stretch_is_not_overriding_align_items__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -192,6 +205,10 @@ fn align_content_stretch_is_not_overriding_align_items__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { @@ -207,6 +224,10 @@ fn align_content_stretch_is_not_overriding_align_items__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, diff --git a/tests/generated/flex/align_content_stretch_row.rs b/tests/generated/flex/align_content_stretch_row.rs index 601ebaa6b..c0d73d3ce 100644 --- a/tests/generated/flex/align_content_stretch_row.rs +++ b/tests/generated/flex/align_content_stretch_row.rs @@ -6,30 +6,35 @@ fn align_content_stretch_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -38,6 +43,10 @@ fn align_content_stretch_row__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -299,6 +308,7 @@ fn align_content_stretch_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -306,6 +316,7 @@ fn align_content_stretch_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -313,6 +324,7 @@ fn align_content_stretch_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -320,6 +332,7 @@ fn align_content_stretch_row__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -327,6 +340,7 @@ fn align_content_stretch_row__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -336,6 +350,10 @@ fn align_content_stretch_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 e56863367..8f45d2f22 100644 --- a/tests/generated/flex/align_content_stretch_row_with_children.rs +++ b/tests/generated/flex/align_content_stretch_row_with_children.rs @@ -6,6 +6,7 @@ fn align_content_stretch_row_with_children__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -16,6 +17,10 @@ fn align_content_stretch_row_with_children__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -24,24 +29,28 @@ fn align_content_stretch_row_with_children__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -50,6 +59,10 @@ fn align_content_stretch_row_with_children__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -356,6 +369,7 @@ fn align_content_stretch_row_with_children__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -367,6 +381,10 @@ fn align_content_stretch_row_with_children__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -376,6 +394,7 @@ fn align_content_stretch_row_with_children__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -383,6 +402,7 @@ fn align_content_stretch_row_with_children__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -390,6 +410,7 @@ fn align_content_stretch_row_with_children__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -397,6 +418,7 @@ fn align_content_stretch_row_with_children__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -406,6 +428,10 @@ fn align_content_stretch_row_with_children__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 b6e401157..1071190d2 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 @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_fixed_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -21,18 +23,21 @@ fn align_content_stretch_row_with_fixed_height__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -41,6 +46,10 @@ fn align_content_stretch_row_with_fixed_height__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -302,6 +311,7 @@ fn align_content_stretch_row_with_fixed_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -309,6 +319,7 @@ fn align_content_stretch_row_with_fixed_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -319,6 +330,7 @@ fn align_content_stretch_row_with_fixed_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -326,6 +338,7 @@ fn align_content_stretch_row_with_fixed_height__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -333,6 +346,7 @@ fn align_content_stretch_row_with_fixed_height__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -342,6 +356,10 @@ fn align_content_stretch_row_with_fixed_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 f5c07fe3e..7d8f60577 100644 --- a/tests/generated/flex/align_content_stretch_row_with_flex.rs +++ b/tests/generated/flex/align_content_stretch_row_with_flex.rs @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -21,12 +23,14 @@ fn align_content_stretch_row_with_flex__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -36,6 +40,7 @@ fn align_content_stretch_row_with_flex__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -44,6 +49,10 @@ fn align_content_stretch_row_with_flex__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -335,6 +344,7 @@ fn align_content_stretch_row_with_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -342,6 +352,7 @@ fn align_content_stretch_row_with_flex__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -352,6 +363,7 @@ fn align_content_stretch_row_with_flex__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -359,6 +371,7 @@ fn align_content_stretch_row_with_flex__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -369,6 +382,7 @@ fn align_content_stretch_row_with_flex__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -378,6 +392,10 @@ fn align_content_stretch_row_with_flex__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 36ccb1c90..7e4eb964d 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 @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_flex_no_shrink__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -21,12 +23,14 @@ fn align_content_stretch_row_with_flex_no_shrink__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -36,6 +40,7 @@ fn align_content_stretch_row_with_flex_no_shrink__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -44,6 +49,10 @@ fn align_content_stretch_row_with_flex_no_shrink__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -335,6 +344,7 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -342,6 +352,7 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -352,6 +363,7 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -359,6 +371,7 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -369,6 +382,7 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -378,6 +392,10 @@ fn align_content_stretch_row_with_flex_no_shrink__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 011178e83..f119f446e 100644 --- a/tests/generated/flex/align_content_stretch_row_with_margin.rs +++ b/tests/generated/flex/align_content_stretch_row_with_margin.rs @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), @@ -24,12 +26,14 @@ fn align_content_stretch_row_with_margin__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), @@ -42,6 +46,7 @@ fn align_content_stretch_row_with_margin__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -50,6 +55,10 @@ fn align_content_stretch_row_with_margin__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -311,6 +320,7 @@ fn align_content_stretch_row_with_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -318,6 +328,7 @@ fn align_content_stretch_row_with_margin__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), @@ -331,6 +342,7 @@ fn align_content_stretch_row_with_margin__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -338,6 +350,7 @@ fn align_content_stretch_row_with_margin__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), @@ -351,6 +364,7 @@ fn align_content_stretch_row_with_margin__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -360,6 +374,10 @@ fn align_content_stretch_row_with_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 37e480943..295992951 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 @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -19,18 +21,21 @@ fn align_content_stretch_row_with_max_height__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -39,6 +44,10 @@ fn align_content_stretch_row_with_max_height__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -300,6 +309,7 @@ fn align_content_stretch_row_with_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -307,6 +317,7 @@ fn align_content_stretch_row_with_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -315,6 +326,7 @@ fn align_content_stretch_row_with_max_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -322,6 +334,7 @@ fn align_content_stretch_row_with_max_height__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -329,6 +342,7 @@ fn align_content_stretch_row_with_max_height__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -338,6 +352,10 @@ fn align_content_stretch_row_with_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 bd4414fd1..feb190d1a 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 @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, ..Default::default() @@ -19,18 +21,21 @@ fn align_content_stretch_row_with_min_height__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -39,6 +44,10 @@ fn align_content_stretch_row_with_min_height__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -300,6 +309,7 @@ fn align_content_stretch_row_with_min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -307,6 +317,7 @@ fn align_content_stretch_row_with_min_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, ..Default::default() @@ -315,6 +326,7 @@ fn align_content_stretch_row_with_min_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -322,6 +334,7 @@ fn align_content_stretch_row_with_min_height__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -329,6 +342,7 @@ fn align_content_stretch_row_with_min_height__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -338,6 +352,10 @@ fn align_content_stretch_row_with_min_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 6ed66feb5..88af1e746 100644 --- a/tests/generated/flex/align_content_stretch_row_with_padding.rs +++ b/tests/generated/flex/align_content_stretch_row_with_padding.rs @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, padding: taffy::geometry::Rect { left: length(10f32), @@ -24,12 +26,14 @@ fn align_content_stretch_row_with_padding__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, padding: taffy::geometry::Rect { left: length(10f32), @@ -42,6 +46,7 @@ fn align_content_stretch_row_with_padding__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -50,6 +55,10 @@ fn align_content_stretch_row_with_padding__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -311,6 +320,7 @@ fn align_content_stretch_row_with_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -318,6 +328,7 @@ fn align_content_stretch_row_with_padding__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, padding: taffy::geometry::Rect { left: length(10f32), @@ -331,6 +342,7 @@ fn align_content_stretch_row_with_padding__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -338,6 +350,7 @@ fn align_content_stretch_row_with_padding__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, padding: taffy::geometry::Rect { left: length(10f32), @@ -351,6 +364,7 @@ fn align_content_stretch_row_with_padding__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -360,6 +374,10 @@ fn align_content_stretch_row_with_padding__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 3fa497905..eaeb1ab8d 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 @@ -6,12 +6,14 @@ fn align_content_stretch_row_with_single_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -20,6 +22,10 @@ fn align_content_stretch_row_with_single_row__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -176,6 +182,7 @@ fn align_content_stretch_row_with_single_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -183,6 +190,7 @@ fn align_content_stretch_row_with_single_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -192,6 +200,10 @@ fn align_content_stretch_row_with_single_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), diff --git a/tests/generated/flex/align_content_stretch_row_wrap.rs b/tests/generated/flex/align_content_stretch_row_wrap.rs index c5f7cf76e..f892a3b65 100644 --- a/tests/generated/flex/align_content_stretch_row_wrap.rs +++ b/tests/generated/flex/align_content_stretch_row_wrap.rs @@ -6,6 +6,7 @@ fn align_content_stretch_row_wrap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(150f32), @@ -16,6 +17,10 @@ fn align_content_stretch_row_wrap__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -26,6 +31,10 @@ fn align_content_stretch_row_wrap__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), @@ -182,6 +191,7 @@ fn align_content_stretch_row_wrap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(150f32), @@ -193,6 +203,10 @@ fn align_content_stretch_row_wrap__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -204,6 +218,10 @@ fn align_content_stretch_row_wrap__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), 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 d566d1583..3934605e7 100644 --- a/tests/generated/flex/align_flex_start_with_shrinking_children.rs +++ b/tests/generated/flex/align_flex_start_with_shrinking_children.rs @@ -4,20 +4,48 @@ fn align_flex_start_with_shrinking_children__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = - taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); let node00 = taffy - .new_with_children(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }, &[node000]) + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }, + &[node000], + ) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::FlexStart), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -212,6 +240,7 @@ fn align_flex_start_with_shrinking_children__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -221,6 +250,10 @@ fn align_flex_start_with_shrinking_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -232,6 +265,10 @@ fn align_flex_start_with_shrinking_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, @@ -242,6 +279,10 @@ fn align_flex_start_with_shrinking_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), 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 b6612b717..13a471362 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 @@ -4,11 +4,21 @@ fn align_flex_start_with_shrinking_children_with_stretch__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = - taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), flex_grow: 1f32, flex_shrink: 1f32, @@ -19,13 +29,24 @@ fn align_flex_start_with_shrinking_children_with_stretch__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::FlexStart), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -220,6 +241,7 @@ fn align_flex_start_with_shrinking_children_with_stretch__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -229,6 +251,10 @@ fn align_flex_start_with_shrinking_children_with_stretch__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), flex_grow: 1f32, flex_shrink: 1f32, @@ -241,6 +267,10 @@ fn align_flex_start_with_shrinking_children_with_stretch__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, @@ -251,6 +281,10 @@ fn align_flex_start_with_shrinking_children_with_stretch__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), 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 b8611144d..bdca009cb 100644 --- a/tests/generated/flex/align_flex_start_with_stretching_children.rs +++ b/tests/generated/flex/align_flex_start_with_stretching_children.rs @@ -4,20 +4,48 @@ fn align_flex_start_with_stretching_children__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = - taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); let node00 = taffy - .new_with_children(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }, &[node000]) + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }, + &[node000], + ) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::Stretch), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::Stretch), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -218,6 +246,7 @@ fn align_flex_start_with_stretching_children__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -227,6 +256,10 @@ fn align_flex_start_with_stretching_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -238,6 +271,10 @@ fn align_flex_start_with_stretching_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), ..Default::default() }, @@ -248,6 +285,10 @@ fn align_flex_start_with_stretching_children__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), diff --git a/tests/generated/flex/align_items_center.rs b/tests/generated/flex/align_items_center.rs index 9ef044414..b324bd540 100644 --- a/tests/generated/flex/align_items_center.rs +++ b/tests/generated/flex/align_items_center.rs @@ -6,6 +6,7 @@ fn align_items_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn align_items_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_items_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -132,6 +138,10 @@ fn align_items_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 1a4126149..5c4daca6b 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 @@ -6,6 +6,7 @@ fn align_items_center_child_with_margin_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -16,13 +17,24 @@ fn align_items_center_child_with_margin_bigger_than_parent__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::Center), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::Center), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -174,6 +186,7 @@ fn align_items_center_child_with_margin_bigger_than_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -186,6 +199,10 @@ fn align_items_center_child_with_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), ..Default::default() }, @@ -196,6 +213,10 @@ fn align_items_center_child_with_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 cc02a9637..dfb467b9f 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 @@ -6,6 +6,7 @@ fn align_items_center_child_without_margin_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(70f32), @@ -15,13 +16,24 @@ fn align_items_center_child_without_margin_bigger_than_parent__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::Center), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::Center), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -173,6 +185,7 @@ fn align_items_center_child_without_margin_bigger_than_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(70f32), @@ -184,6 +197,10 @@ fn align_items_center_child_without_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), ..Default::default() }, @@ -194,6 +211,10 @@ fn align_items_center_child_without_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 b292b0c75..9d2df2cc7 100644 --- a/tests/generated/flex/align_items_center_justify_content_center.rs +++ b/tests/generated/flex/align_items_center_justify_content_center.rs @@ -7,6 +7,10 @@ fn align_items_center_justify_content_center__border_box() { let node000 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -20,6 +24,10 @@ fn align_items_center_justify_content_center__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, @@ -38,6 +46,10 @@ fn align_items_center_justify_content_center__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, @@ -50,6 +62,10 @@ fn align_items_center_justify_content_center__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -245,6 +261,10 @@ fn align_items_center_justify_content_center__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -259,6 +279,10 @@ fn align_items_center_justify_content_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, @@ -278,6 +302,10 @@ fn align_items_center_justify_content_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, @@ -291,6 +319,10 @@ fn align_items_center_justify_content_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), 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 384139a78..41c6c450f 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 @@ -6,6 +6,7 @@ fn align_items_center_min_max_with_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(62f32), height: taffy::style::Dimension::from_length(62f32), @@ -16,6 +17,10 @@ fn align_items_center_min_max_with_padding__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), @@ -126,6 +131,7 @@ fn align_items_center_min_max_with_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(62f32), height: taffy::style::Dimension::from_length(62f32), @@ -137,6 +143,10 @@ fn align_items_center_min_max_with_padding__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), 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 8b6987a7b..23f3ea611 100644 --- a/tests/generated/flex/align_items_center_with_child_margin.rs +++ b/tests/generated/flex/align_items_center_with_child_margin.rs @@ -6,6 +6,7 @@ fn align_items_center_with_child_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_items_center_with_child_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_items_center_with_child_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_items_center_with_child_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 b2a674b39..49f64aa8b 100644 --- a/tests/generated/flex/align_items_center_with_child_top.rs +++ b/tests/generated/flex/align_items_center_with_child_top.rs @@ -6,6 +6,7 @@ fn align_items_center_with_child_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_items_center_with_child_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_items_center_with_child_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_items_center_with_child_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs b/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs index 1e47da6b8..f6f1aeaf0 100644 --- a/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs +++ b/tests/generated/flex/align_items_center_with_height_with_padding_border_with_wrap.rs @@ -6,6 +6,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -27,6 +29,10 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { @@ -40,6 +46,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -49,6 +56,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -61,6 +69,10 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -71,7 +83,18 @@ fn align_items_center_with_height_with_padding_border_with_wrap__border_box() { &[node10, node11], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -398,6 +421,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -408,6 +432,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -421,6 +446,10 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { @@ -435,6 +464,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -445,6 +475,7 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -458,6 +489,10 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -470,7 +505,14 @@ fn align_items_center_with_height_with_padding_border_with_wrap__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); diff --git a/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs index 6938f8f64..4cc92e9fe 100644 --- a/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_max_height_percentage_with_align_content_flex_start.rs @@ -6,6 +6,7 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,10 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { @@ -44,6 +50,10 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -238,6 +248,7 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -248,6 +259,7 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -260,6 +272,10 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { @@ -279,6 +295,10 @@ fn align_items_center_with_max_height_percentage_with_align_content_flex_start__ .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs index aad8d2531..c0f18b9c6 100644 --- a/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_max_height_with_align_content_flex_start.rs @@ -6,6 +6,7 @@ fn align_items_center_with_max_height_with_align_content_flex_start__border_box( let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn align_items_center_with_max_height_with_align_content_flex_start__border_box( .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -25,6 +27,10 @@ fn align_items_center_with_max_height_with_align_content_flex_start__border_box( let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -174,6 +180,7 @@ fn align_items_center_with_max_height_with_align_content_flex_start__content_box let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(50f32), @@ -184,6 +191,7 @@ fn align_items_center_with_max_height_with_align_content_flex_start__content_box let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -195,6 +203,10 @@ fn align_items_center_with_max_height_with_align_content_flex_start__content_box .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, diff --git a/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs b/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs index a40e59dc0..fe468742e 100644 --- a/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs +++ b/tests/generated/flex/align_items_center_with_max_height_with_padding_border.rs @@ -6,6 +6,7 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -26,6 +28,10 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -49,6 +55,7 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -58,6 +65,7 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -70,6 +78,10 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -93,7 +105,14 @@ fn align_items_center_with_max_height_with_padding_border__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -423,6 +442,7 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -433,6 +453,7 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -445,6 +466,10 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -469,6 +494,7 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -479,6 +505,7 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(150f32), @@ -492,6 +519,10 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -518,6 +549,10 @@ fn align_items_center_with_max_height_with_padding_border__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs index 8f48d3fc6..a6a6fc517 100644 --- a/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_min_height_percentage_with_align_content_flex_start.rs @@ -6,6 +6,7 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,10 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -38,6 +44,10 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -238,6 +248,7 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -248,6 +259,7 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -260,6 +272,10 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -273,6 +289,10 @@ fn align_items_center_with_min_height_percentage_with_align_content_flex_start__ .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs index 80b7f1136..1a77e8aec 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start.rs @@ -6,6 +6,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start__border_box( let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start__border_box( .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -25,6 +27,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start__border_box( let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -168,6 +174,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start__content_box let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -178,6 +185,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start__content_box let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -189,6 +197,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start__content_box .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, diff --git a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs index 7fca1296d..724eb4564 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_align_content_flex_start_with_wrap.rs @@ -6,6 +6,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -27,6 +29,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -38,6 +44,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -47,6 +54,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -59,6 +67,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -69,6 +81,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -78,6 +91,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node21 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -89,6 +103,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -99,6 +117,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node30 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -108,6 +127,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .unwrap(); let node31 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -119,6 +139,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -128,8 +152,18 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__b &[node30, node31], ) .unwrap(); - let node = - taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1, node2, node3]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1, node2, node3], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -726,6 +760,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -736,6 +771,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -749,6 +785,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -761,6 +801,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -771,6 +812,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -784,6 +826,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -795,6 +841,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -805,6 +852,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node21 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -817,6 +865,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -828,6 +880,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node30 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -838,6 +891,7 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c let node31 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -850,6 +904,10 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -861,7 +919,14 @@ fn align_items_center_with_min_height_with_align_content_flex_start_with_wrap__c .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1, node2, node3], ) .unwrap(); diff --git a/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs b/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs index f7c9346a9..20f4c210e 100644 --- a/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs +++ b/tests/generated/flex/align_items_center_with_min_height_with_padding_border.rs @@ -6,6 +6,7 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,10 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -49,6 +55,7 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -58,6 +65,7 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -70,6 +78,10 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -91,7 +103,18 @@ fn align_items_center_with_min_height_with_padding_border__border_box() { &[node10, node11], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -418,6 +441,7 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -428,6 +452,7 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -440,6 +465,10 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -464,6 +493,7 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -474,6 +504,7 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(20f32), @@ -487,6 +518,10 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -510,7 +545,14 @@ fn align_items_center_with_min_height_with_padding_border__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); diff --git a/tests/generated/flex/align_items_flex_end.rs b/tests/generated/flex/align_items_flex_end.rs index 5a9c18469..3778d92ee 100644 --- a/tests/generated/flex/align_items_flex_end.rs +++ b/tests/generated/flex/align_items_flex_end.rs @@ -6,6 +6,7 @@ fn align_items_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn align_items_flex_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_items_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -132,6 +138,10 @@ fn align_items_flex_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 57756a0c6..da202cd23 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 @@ -6,6 +6,7 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -16,13 +17,24 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::FlexEnd), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::FlexEnd), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -174,6 +186,7 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -186,6 +199,10 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), ..Default::default() }, @@ -196,6 +213,10 @@ fn align_items_flex_end_child_with_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { 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 7e17215bf..b40e18f65 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 @@ -6,6 +6,7 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(70f32), @@ -15,13 +16,24 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_items: Some(taffy::style::AlignItems::FlexEnd), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_items: Some(taffy::style::AlignItems::FlexEnd), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -173,6 +185,7 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(70f32), @@ -184,6 +197,10 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), ..Default::default() }, @@ -194,6 +211,10 @@ fn align_items_flex_end_child_without_margin_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/flex/align_items_flex_start.rs b/tests/generated/flex/align_items_flex_start.rs index d32f071b3..6eb4274f1 100644 --- a/tests/generated/flex/align_items_flex_start.rs +++ b/tests/generated/flex/align_items_flex_start.rs @@ -6,6 +6,7 @@ fn align_items_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn align_items_flex_start__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_items_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -132,6 +138,10 @@ fn align_items_flex_start__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_items_min_max.rs b/tests/generated/flex/align_items_min_max.rs index 15e0d875c..0e1416f48 100644 --- a/tests/generated/flex/align_items_min_max.rs +++ b/tests/generated/flex/align_items_min_max.rs @@ -6,6 +6,7 @@ fn align_items_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,10 @@ fn align_items_min_max__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -121,6 +126,7 @@ fn align_items_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(60f32), @@ -133,6 +139,10 @@ fn align_items_min_max__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, diff --git a/tests/generated/flex/align_items_stretch.rs b/tests/generated/flex/align_items_stretch.rs index eb7b5beac..322a59029 100644 --- a/tests/generated/flex/align_items_stretch.rs +++ b/tests/generated/flex/align_items_stretch.rs @@ -6,6 +6,7 @@ fn align_items_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -13,6 +14,10 @@ fn align_items_stretch__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn align_items_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -131,6 +137,10 @@ fn align_items_stretch__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_items_stretch_min_cross.rs b/tests/generated/flex/align_items_stretch_min_cross.rs index cf170dfd7..be76b17fd 100644 --- a/tests/generated/flex/align_items_stretch_min_cross.rs +++ b/tests/generated/flex/align_items_stretch_min_cross.rs @@ -6,6 +6,7 @@ fn align_items_stretch_min_cross__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(36f32) }, ..Default::default() @@ -15,6 +16,10 @@ fn align_items_stretch_min_cross__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(50f32), @@ -119,6 +124,7 @@ fn align_items_stretch_min_cross__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(36f32) }, ..Default::default() @@ -129,6 +135,10 @@ fn align_items_stretch_min_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/align_self_baseline.rs b/tests/generated/flex/align_self_baseline.rs index c2f25a1ef..9aaae6ae9 100644 --- a/tests/generated/flex/align_self_baseline.rs +++ b/tests/generated/flex/align_self_baseline.rs @@ -6,6 +6,7 @@ fn align_self_baseline__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -16,6 +17,7 @@ fn align_self_baseline__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn align_self_baseline__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -39,6 +45,10 @@ fn align_self_baseline__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -227,6 +237,7 @@ fn align_self_baseline__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -238,6 +249,7 @@ fn align_self_baseline__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -249,6 +261,10 @@ fn align_self_baseline__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -263,6 +279,10 @@ fn align_self_baseline__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_self_center.rs b/tests/generated/flex/align_self_center.rs index 749d92c4b..4b6068381 100644 --- a/tests/generated/flex/align_self_center.rs +++ b/tests/generated/flex/align_self_center.rs @@ -6,6 +6,7 @@ fn align_self_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_self_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_self_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -133,6 +139,10 @@ fn align_self_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 9d5423d47..f340d1d87 100644 --- a/tests/generated/flex/align_self_center_undefined_max_height.rs +++ b/tests/generated/flex/align_self_center_undefined_max_height.rs @@ -6,6 +6,7 @@ fn align_self_center_undefined_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(44f32), @@ -15,6 +16,7 @@ fn align_self_center_undefined_max_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -26,6 +28,10 @@ fn align_self_center_undefined_max_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(280f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(52f32) }, ..Default::default() @@ -167,6 +173,7 @@ fn align_self_center_undefined_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(44f32), @@ -177,6 +184,7 @@ fn align_self_center_undefined_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -189,6 +197,10 @@ fn align_self_center_undefined_max_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(280f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(52f32) }, ..Default::default() diff --git a/tests/generated/flex/align_self_flex_end.rs b/tests/generated/flex/align_self_flex_end.rs index 64f28f54c..ced2484f5 100644 --- a/tests/generated/flex/align_self_flex_end.rs +++ b/tests/generated/flex/align_self_flex_end.rs @@ -6,6 +6,7 @@ fn align_self_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_self_flex_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_self_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -133,6 +139,10 @@ fn align_self_flex_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 285b725d9..bb6d132e9 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 @@ -6,6 +6,7 @@ fn align_self_flex_end_override_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_self_flex_end_override_flex_start__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn align_self_flex_end_override_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -134,6 +140,10 @@ fn align_self_flex_end_override_flex_start__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/align_self_flex_start.rs b/tests/generated/flex/align_self_flex_start.rs index 1013e74ae..dbade17d0 100644 --- a/tests/generated/flex/align_self_flex_start.rs +++ b/tests/generated/flex/align_self_flex_start.rs @@ -6,6 +6,7 @@ fn align_self_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn align_self_flex_start__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn align_self_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -133,6 +139,10 @@ fn align_self_flex_start__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 85f5b2e82..d0bf76023 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 @@ -6,6 +6,7 @@ fn align_stretch_should_size_based_on_parent__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -14,11 +15,26 @@ fn align_stretch_should_size_based_on_parent__border_box() { }) .unwrap(); let node00 = taffy - .new_with_children(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }, &[node000]) + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }, + &[node000], + ) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), flex_grow: 0f32, flex_shrink: 1f32, @@ -30,6 +46,10 @@ fn align_stretch_should_size_based_on_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -230,6 +250,7 @@ fn align_stretch_should_size_based_on_parent__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -241,6 +262,10 @@ fn align_stretch_should_size_based_on_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -252,6 +277,10 @@ fn align_stretch_should_size_based_on_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), flex_grow: 0f32, flex_shrink: 1f32, @@ -264,6 +293,10 @@ fn align_stretch_should_size_based_on_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/android_news_feed.rs b/tests/generated/flex/android_news_feed.rs index 9afb9937c..029bc9bc2 100644 --- a/tests/generated/flex/android_news_feed.rs +++ b/tests/generated/flex/android_news_feed.rs @@ -6,6 +6,7 @@ fn android_news_feed__border_box() { let mut taffy = crate::new_test_tree(); let node000000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { @@ -18,6 +19,10 @@ fn android_news_feed__border_box() { let node00000 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, ..Default::default() @@ -27,6 +32,7 @@ fn android_news_feed__border_box() { .unwrap(); let node000010 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -34,6 +40,7 @@ fn android_news_feed__border_box() { .unwrap(); let node000011 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -43,6 +50,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(36f32), top: zero(), bottom: zero() }, @@ -60,6 +71,10 @@ fn android_news_feed__border_box() { let node0000 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Stretch), margin: taffy::geometry::Rect { @@ -77,6 +92,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -85,6 +104,7 @@ fn android_news_feed__border_box() { .unwrap(); let node001000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { @@ -97,6 +117,10 @@ fn android_news_feed__border_box() { let node00100 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, ..Default::default() @@ -106,6 +130,7 @@ fn android_news_feed__border_box() { .unwrap(); let node001010 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -113,6 +138,7 @@ fn android_news_feed__border_box() { .unwrap(); let node001011 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -122,6 +148,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(36f32), top: zero(), bottom: zero() }, @@ -139,6 +169,10 @@ fn android_news_feed__border_box() { let node0010 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Stretch), margin: taffy::geometry::Rect { @@ -156,6 +190,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -166,6 +204,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -176,6 +218,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_shrink: 0f32, ..Default::default() }, @@ -186,6 +232,10 @@ fn android_news_feed__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1080f32), height: auto() }, @@ -1210,6 +1260,7 @@ fn android_news_feed__content_box() { let node000000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { @@ -1223,6 +1274,10 @@ fn android_news_feed__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, ..Default::default() @@ -1233,6 +1288,7 @@ fn android_news_feed__content_box() { let node000010 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -1241,6 +1297,7 @@ fn android_news_feed__content_box() { let node000011 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -1251,6 +1308,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(36f32), top: zero(), bottom: zero() }, @@ -1269,6 +1330,10 @@ fn android_news_feed__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Stretch), margin: taffy::geometry::Rect { @@ -1287,6 +1352,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -1296,6 +1365,7 @@ fn android_news_feed__content_box() { let node001000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { @@ -1309,6 +1379,10 @@ fn android_news_feed__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, ..Default::default() @@ -1319,6 +1393,7 @@ fn android_news_feed__content_box() { let node001010 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -1327,6 +1402,7 @@ fn android_news_feed__content_box() { let node001011 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, ..Default::default() @@ -1337,6 +1413,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(36f32), top: zero(), bottom: zero() }, @@ -1355,6 +1435,10 @@ fn android_news_feed__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Stretch), margin: taffy::geometry::Rect { @@ -1373,6 +1457,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -1384,6 +1472,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -1395,6 +1487,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_shrink: 0f32, ..Default::default() }, @@ -1406,6 +1502,10 @@ fn android_news_feed__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1080f32), height: auto() }, 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 7d113b3c4..d22ad52e6 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_height.rs @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_fill_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_fill_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn aspect_ratio_flex_column_fill_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -132,6 +138,10 @@ fn aspect_ratio_flex_column_fill_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 7750c6645..5fa7cf111 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 @@ -9,6 +9,10 @@ fn aspect_ratio_flex_column_fill_max_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -21,6 +25,10 @@ fn aspect_ratio_flex_column_fill_max_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -129,6 +137,10 @@ fn aspect_ratio_flex_column_fill_max_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -142,6 +154,10 @@ fn aspect_ratio_flex_column_fill_max_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 2b52bfcd5..da21b6c50 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_column_fill_max_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -19,6 +23,10 @@ fn aspect_ratio_flex_column_fill_max_width__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -125,6 +133,10 @@ fn aspect_ratio_flex_column_fill_max_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -138,6 +150,10 @@ fn aspect_ratio_flex_column_fill_max_width__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 a85abe4bb..9e27d3329 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_fill_min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_fill_min_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn aspect_ratio_flex_column_fill_min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -132,6 +138,10 @@ fn aspect_ratio_flex_column_fill_min_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 606f0feeb..77c3850f6 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_column_fill_min_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -19,6 +23,10 @@ fn aspect_ratio_flex_column_fill_min_width__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -125,6 +133,10 @@ fn aspect_ratio_flex_column_fill_min_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -138,6 +150,10 @@ fn aspect_ratio_flex_column_fill_min_width__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 fe3783afb..c7ea6e08c 100644 --- a/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_column_fill_width.rs @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_fill_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_fill_width__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -121,6 +126,7 @@ fn aspect_ratio_flex_column_fill_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -132,6 +138,10 @@ fn aspect_ratio_flex_column_fill_width__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 139c3ca1d..daa640ee8 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_fill_width_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_fill_width_flex__border_box() { taffy::style::Style { display: taffy::style::Display::Grid, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_column_fill_width_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn aspect_ratio_flex_column_fill_width_flex__content_box() { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 2f4def816..c4643404a 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_stretch_fill_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_stretch_fill_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_column_stretch_fill_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn aspect_ratio_flex_column_stretch_fill_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 6b0df775f..21c43688e 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 @@ -9,6 +9,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -21,6 +25,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -128,6 +136,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -141,6 +153,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 d6060fb22..c2812e3ef 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -19,6 +23,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +132,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -137,6 +149,10 @@ fn aspect_ratio_flex_column_stretch_fill_max_width__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 2e2ae8bdc..227743fca 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_column_stretch_fill_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -16,6 +17,10 @@ fn aspect_ratio_flex_column_stretch_fill_width__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_column_stretch_fill_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -131,6 +137,10 @@ fn aspect_ratio_flex_column_stretch_fill_width__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 2b5743911..9cec09958 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_height.rs @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_fill_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_fill_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_row_fill_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -130,6 +136,10 @@ fn aspect_ratio_flex_row_fill_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 9e4ec7b97..27e4f6645 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 @@ -9,6 +9,10 @@ fn aspect_ratio_flex_row_fill_max_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -20,6 +24,10 @@ fn aspect_ratio_flex_row_fill_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -128,6 +136,10 @@ fn aspect_ratio_flex_row_fill_max_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -140,6 +152,10 @@ fn aspect_ratio_flex_row_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 f878fe0ec..6b1cd045c 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_row_fill_max_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -18,6 +22,10 @@ fn aspect_ratio_flex_row_fill_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -124,6 +132,10 @@ fn aspect_ratio_flex_row_fill_max_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -136,6 +148,10 @@ fn aspect_ratio_flex_row_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 593940d46..9d978dc17 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_fill_min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_fill_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_row_fill_min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -130,6 +136,10 @@ fn aspect_ratio_flex_row_fill_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 576930265..ef6b8d7bf 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_row_fill_min_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -18,6 +22,10 @@ fn aspect_ratio_flex_row_fill_min_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -124,6 +132,10 @@ fn aspect_ratio_flex_row_fill_min_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -136,6 +148,10 @@ fn aspect_ratio_flex_row_fill_min_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 e3678a1df..227cdd364 100644 --- a/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs +++ b/tests/generated/flex/aspect_ratio_flex_row_fill_width.rs @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_fill_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_fill_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_row_fill_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -130,6 +136,10 @@ fn aspect_ratio_flex_row_fill_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 6345902bd..be4079147 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_fill_width_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_fill_width_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn aspect_ratio_flex_row_fill_width_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -130,6 +136,10 @@ fn aspect_ratio_flex_row_fill_width_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 69f9c316a..733ce2b89 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_stretch_fill_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_stretch_fill_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn aspect_ratio_flex_row_stretch_fill_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -135,6 +141,10 @@ fn aspect_ratio_flex_row_stretch_fill_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 c1d32fab6..031731e52 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 @@ -9,6 +9,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -20,6 +24,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -133,6 +141,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -145,6 +157,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 14d0c6225..0360b84f4 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 @@ -7,6 +7,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -18,6 +22,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +131,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -135,6 +147,10 @@ fn aspect_ratio_flex_row_stretch_fill_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 fc0a50120..c0aa156c6 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 @@ -6,6 +6,7 @@ fn aspect_ratio_flex_row_stretch_fill_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn aspect_ratio_flex_row_stretch_fill_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn aspect_ratio_flex_row_stretch_fill_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(40f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -129,6 +135,10 @@ fn aspect_ratio_flex_row_stretch_fill_width__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/bevy_issue_10343_block.rs b/tests/generated/flex/bevy_issue_10343_block.rs index e87685105..d0e4f3970 100644 --- a/tests/generated/flex/bevy_issue_10343_block.rs +++ b/tests/generated/flex/bevy_issue_10343_block.rs @@ -4,11 +4,20 @@ fn bevy_issue_10343_block__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -26,7 +35,14 @@ fn bevy_issue_10343_block__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -35,6 +51,10 @@ fn bevy_issue_10343_block__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -234,13 +254,21 @@ fn bevy_issue_10343_block__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node000 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -261,6 +289,10 @@ fn bevy_issue_10343_block__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -272,6 +304,10 @@ fn bevy_issue_10343_block__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/bevy_issue_10343_flex.rs b/tests/generated/flex/bevy_issue_10343_flex.rs index a2d007a2e..663cac392 100644 --- a/tests/generated/flex/bevy_issue_10343_flex.rs +++ b/tests/generated/flex/bevy_issue_10343_flex.rs @@ -4,11 +4,20 @@ fn bevy_issue_10343_flex__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -26,7 +35,14 @@ fn bevy_issue_10343_flex__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -35,6 +51,10 @@ fn bevy_issue_10343_flex__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -234,13 +254,21 @@ fn bevy_issue_10343_flex__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node000 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -261,6 +289,10 @@ fn bevy_issue_10343_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -272,6 +304,10 @@ fn bevy_issue_10343_flex__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/bevy_issue_10343_grid.rs b/tests/generated/flex/bevy_issue_10343_grid.rs index 8760e16b4..f1c867e82 100644 --- a/tests/generated/flex/bevy_issue_10343_grid.rs +++ b/tests/generated/flex/bevy_issue_10343_grid.rs @@ -4,11 +4,20 @@ fn bevy_issue_10343_grid__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -26,7 +35,14 @@ fn bevy_issue_10343_grid__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -35,6 +51,10 @@ fn bevy_issue_10343_grid__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -234,13 +254,21 @@ fn bevy_issue_10343_grid__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node000 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -261,6 +289,10 @@ fn bevy_issue_10343_grid__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -272,6 +304,10 @@ fn bevy_issue_10343_grid__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/bevy_issue_16304.rs b/tests/generated/flex/bevy_issue_16304.rs index d5628e28c..cef2bca70 100644 --- a/tests/generated/flex/bevy_issue_16304.rs +++ b/tests/generated/flex/bevy_issue_16304.rs @@ -6,6 +6,7 @@ fn bevy_issue_16304__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -15,6 +16,7 @@ fn bevy_issue_16304__border_box() { .unwrap(); let node001 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -27,6 +29,10 @@ fn bevy_issue_16304__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -39,6 +45,10 @@ fn bevy_issue_16304__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -46,7 +56,17 @@ fn bevy_issue_16304__border_box() { ) .unwrap(); let node = taffy - .new_with_children(taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, &[node0]) + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); @@ -278,6 +298,7 @@ fn bevy_issue_16304__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -288,6 +309,7 @@ fn bevy_issue_16304__content_box() { let node001 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -301,6 +323,10 @@ fn bevy_issue_16304__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -314,6 +340,10 @@ fn bevy_issue_16304__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -325,6 +355,10 @@ fn bevy_issue_16304__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/flex/bevy_issue_21240.rs b/tests/generated/flex/bevy_issue_21240.rs index 405a87e58..a1ff34727 100644 --- a/tests/generated/flex/bevy_issue_21240.rs +++ b/tests/generated/flex/bevy_issue_21240.rs @@ -4,18 +4,40 @@ fn bevy_issue_21240__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: line(-1i16) }, ..Default::default() }) .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(4u16) }, ..Default::default() }) @@ -24,6 +46,10 @@ fn bevy_issue_21240__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32), length(40f32)], @@ -326,20 +352,37 @@ fn bevy_issue_21240__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: line(-1i16) }, ..Default::default() }) @@ -347,6 +390,7 @@ fn bevy_issue_21240__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(4u16) }, ..Default::default() }) @@ -356,6 +400,10 @@ fn bevy_issue_21240__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/flex/bevy_issue_7976_3_level.rs b/tests/generated/flex/bevy_issue_7976_3_level.rs index 2f98d1d37..76cf12798 100644 --- a/tests/generated/flex/bevy_issue_7976_3_level.rs +++ b/tests/generated/flex/bevy_issue_7976_3_level.rs @@ -6,6 +6,7 @@ fn bevy_issue_7976_3_level__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -22,6 +23,10 @@ fn bevy_issue_7976_3_level__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -46,6 +51,10 @@ fn bevy_issue_7976_3_level__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -202,6 +211,7 @@ fn bevy_issue_7976_3_level__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -219,6 +229,10 @@ fn bevy_issue_7976_3_level__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -244,6 +258,10 @@ fn bevy_issue_7976_3_level__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/bevy_issue_7976_4_level.rs b/tests/generated/flex/bevy_issue_7976_4_level.rs index 1d3feac88..c4645d580 100644 --- a/tests/generated/flex/bevy_issue_7976_4_level.rs +++ b/tests/generated/flex/bevy_issue_7976_4_level.rs @@ -4,10 +4,19 @@ fn bevy_issue_7976_4_level__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node000 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node000 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -26,6 +35,10 @@ fn bevy_issue_7976_4_level__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -50,6 +63,10 @@ fn bevy_issue_7976_4_level__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -249,12 +266,20 @@ fn bevy_issue_7976_4_level__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node000 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00 = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -274,6 +299,10 @@ fn bevy_issue_7976_4_level__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -299,6 +328,10 @@ fn bevy_issue_7976_4_level__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/bevy_issue_7976_reduced.rs b/tests/generated/flex/bevy_issue_7976_reduced.rs index 9216f4508..f4381fa24 100644 --- a/tests/generated/flex/bevy_issue_7976_reduced.rs +++ b/tests/generated/flex/bevy_issue_7976_reduced.rs @@ -6,6 +6,7 @@ fn bevy_issue_7976_reduced__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, ..Default::default() }) @@ -13,6 +14,10 @@ fn bevy_issue_7976_reduced__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -121,6 +126,7 @@ fn bevy_issue_7976_reduced__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, ..Default::default() }) @@ -129,6 +135,10 @@ fn bevy_issue_7976_reduced__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() diff --git a/tests/generated/flex/bevy_issue_8017.rs b/tests/generated/flex/bevy_issue_8017.rs index 2b9e66ef6..237d34aa3 100644 --- a/tests/generated/flex/bevy_issue_8017.rs +++ b/tests/generated/flex/bevy_issue_8017.rs @@ -6,6 +6,7 @@ fn bevy_issue_8017__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -15,6 +16,7 @@ fn bevy_issue_8017__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -26,6 +28,10 @@ fn bevy_issue_8017__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -38,6 +44,7 @@ fn bevy_issue_8017__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -47,6 +54,7 @@ fn bevy_issue_8017__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -58,6 +66,10 @@ fn bevy_issue_8017__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -73,6 +85,10 @@ fn bevy_issue_8017__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), @@ -415,6 +431,7 @@ fn bevy_issue_8017__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -425,6 +442,7 @@ fn bevy_issue_8017__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -437,6 +455,10 @@ fn bevy_issue_8017__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -450,6 +472,7 @@ fn bevy_issue_8017__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -460,6 +483,7 @@ fn bevy_issue_8017__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -472,6 +496,10 @@ fn bevy_issue_8017__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -488,6 +516,10 @@ fn bevy_issue_8017__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), diff --git a/tests/generated/flex/bevy_issue_8017_reduced.rs b/tests/generated/flex/bevy_issue_8017_reduced.rs index f1d90be0e..41ba5a3e7 100644 --- a/tests/generated/flex/bevy_issue_8017_reduced.rs +++ b/tests/generated/flex/bevy_issue_8017_reduced.rs @@ -4,20 +4,38 @@ fn bevy_issue_8017_reduced__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.5f32) }, ..Default::default() }, &[node00], ) .unwrap(); - let node10 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node10 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.5f32) }, ..Default::default() }, @@ -28,6 +46,10 @@ fn bevy_issue_8017_reduced__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -272,12 +294,20 @@ fn bevy_issue_8017_reduced__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.5f32) }, ..Default::default() }, @@ -285,12 +315,20 @@ fn bevy_issue_8017_reduced__content_box() { ) .unwrap(); let node10 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.5f32) }, ..Default::default() }, @@ -302,6 +340,10 @@ fn bevy_issue_8017_reduced__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(8f32), height: length(8f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/bevy_issue_8082.rs b/tests/generated/flex/bevy_issue_8082.rs index 1ad879ad3..b6976dcb1 100644 --- a/tests/generated/flex/bevy_issue_8082.rs +++ b/tests/generated/flex/bevy_issue_8082.rs @@ -6,6 +6,7 @@ fn bevy_issue_8082__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn bevy_issue_8082__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -36,6 +38,7 @@ fn bevy_issue_8082__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -51,6 +54,7 @@ fn bevy_issue_8082__border_box() { .unwrap(); let node03 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -68,6 +72,10 @@ fn bevy_issue_8082__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -80,6 +88,10 @@ fn bevy_issue_8082__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::FlexStart), @@ -373,6 +385,7 @@ fn bevy_issue_8082__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -389,6 +402,7 @@ fn bevy_issue_8082__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -405,6 +419,7 @@ fn bevy_issue_8082__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -421,6 +436,7 @@ fn bevy_issue_8082__content_box() { let node03 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -439,6 +455,10 @@ fn bevy_issue_8082__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -452,6 +472,10 @@ fn bevy_issue_8082__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::FlexStart), diff --git a/tests/generated/flex/bevy_issue_8082_percent.rs b/tests/generated/flex/bevy_issue_8082_percent.rs index a6528c28d..fc8657b5f 100644 --- a/tests/generated/flex/bevy_issue_8082_percent.rs +++ b/tests/generated/flex/bevy_issue_8082_percent.rs @@ -6,6 +6,7 @@ fn bevy_issue_8082_percent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn bevy_issue_8082_percent__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -24,6 +26,7 @@ fn bevy_issue_8082_percent__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -33,6 +36,7 @@ fn bevy_issue_8082_percent__border_box() { .unwrap(); let node03 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -44,6 +48,10 @@ fn bevy_issue_8082_percent__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -57,6 +65,10 @@ fn bevy_issue_8082_percent__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::FlexStart), @@ -350,6 +362,7 @@ fn bevy_issue_8082_percent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -360,6 +373,7 @@ fn bevy_issue_8082_percent__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -370,6 +384,7 @@ fn bevy_issue_8082_percent__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -380,6 +395,7 @@ fn bevy_issue_8082_percent__content_box() { let node03 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -392,6 +408,10 @@ fn bevy_issue_8082_percent__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -406,6 +426,10 @@ fn bevy_issue_8082_percent__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::FlexStart), diff --git a/tests/generated/flex/bevy_issue_9530.rs b/tests/generated/flex/bevy_issue_9530.rs index b4ccff40a..2b5ccebf0 100644 --- a/tests/generated/flex/bevy_issue_9530.rs +++ b/tests/generated/flex/bevy_issue_9530.rs @@ -7,6 +7,7 @@ fn bevy_issue_9530__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn bevy_issue_9530__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -27,6 +29,10 @@ fn bevy_issue_9530__border_box() { let node11 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -44,6 +50,7 @@ fn bevy_issue_9530__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -55,6 +62,10 @@ fn bevy_issue_9530__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, margin: taffy::geometry::Rect { @@ -78,6 +89,10 @@ fn bevy_issue_9530__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { @@ -371,6 +386,7 @@ fn bevy_issue_9530__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(20f32), @@ -381,6 +397,7 @@ fn bevy_issue_9530__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -393,6 +410,10 @@ fn bevy_issue_9530__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -411,6 +432,7 @@ fn bevy_issue_9530__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -423,6 +445,10 @@ fn bevy_issue_9530__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, margin: taffy::geometry::Rect { @@ -447,6 +473,10 @@ fn bevy_issue_9530__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/flex/bevy_issue_9530_reduced.rs b/tests/generated/flex/bevy_issue_9530_reduced.rs index de9f85915..d30e42630 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced.rs @@ -6,7 +6,14 @@ fn bevy_issue_9530_reduced__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { flex_grow: 1f32, ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +21,10 @@ fn bevy_issue_9530_reduced__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -24,6 +35,10 @@ fn bevy_issue_9530_reduced__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, ..Default::default() }, @@ -171,6 +186,10 @@ fn bevy_issue_9530_reduced__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -182,6 +201,10 @@ fn bevy_issue_9530_reduced__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -193,6 +216,10 @@ fn bevy_issue_9530_reduced__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/bevy_issue_9530_reduced2.rs b/tests/generated/flex/bevy_issue_9530_reduced2.rs index ce2b9395c..43e2df3de 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced2.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced2.rs @@ -6,7 +6,14 @@ fn bevy_issue_9530_reduced2__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { flex_grow: 1f32, ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + ..Default::default() + }, crate::TestNodeContext::ahem_text( "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal, @@ -17,6 +24,10 @@ fn bevy_issue_9530_reduced2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, margin: taffy::geometry::Rect { @@ -32,7 +43,14 @@ fn bevy_issue_9530_reduced2__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -177,6 +195,10 @@ fn bevy_issue_9530_reduced2__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -191,6 +213,10 @@ fn bevy_issue_9530_reduced2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, margin: taffy::geometry::Rect { @@ -209,6 +235,10 @@ fn bevy_issue_9530_reduced2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/flex/bevy_issue_9530_reduced3.rs b/tests/generated/flex/bevy_issue_9530_reduced3.rs index 83efe58bf..90a8c026f 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced3.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced3.rs @@ -7,6 +7,10 @@ fn bevy_issue_9530_reduced3__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(20f32), @@ -26,6 +30,10 @@ fn bevy_issue_9530_reduced3__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() }, @@ -128,6 +136,10 @@ fn bevy_issue_9530_reduced3__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(20f32), @@ -148,6 +160,10 @@ fn bevy_issue_9530_reduced3__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/bevy_issue_9530_reduced4.rs b/tests/generated/flex/bevy_issue_9530_reduced4.rs index a033d639e..8b8616faf 100644 --- a/tests/generated/flex/bevy_issue_9530_reduced4.rs +++ b/tests/generated/flex/bevy_issue_9530_reduced4.rs @@ -7,6 +7,10 @@ fn bevy_issue_9530_reduced4__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: length(20f32), right: length(20f32), @@ -25,6 +29,10 @@ fn bevy_issue_9530_reduced4__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() }, @@ -127,6 +135,10 @@ fn bevy_issue_9530_reduced4__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: length(20f32), right: length(20f32), @@ -146,6 +158,10 @@ fn bevy_issue_9530_reduced4__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/blitz_issue_88.rs b/tests/generated/flex/blitz_issue_88.rs index ee5bd58fd..8eaeb86bb 100644 --- a/tests/generated/flex/blitz_issue_88.rs +++ b/tests/generated/flex/blitz_issue_88.rs @@ -8,6 +8,10 @@ fn blitz_issue_88__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -20,7 +24,15 @@ fn blitz_issue_88__border_box() { .unwrap(); let node00 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, flex_grow: 1f32, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_grow: 1f32, + ..Default::default() + }, &[node000], ) .unwrap(); @@ -29,6 +41,10 @@ fn blitz_issue_88__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), ..Default::default() }, @@ -39,6 +55,10 @@ fn blitz_issue_88__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: auto() }, ..Default::default() }, @@ -238,6 +258,10 @@ fn blitz_issue_88__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -253,6 +277,10 @@ fn blitz_issue_88__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -265,6 +293,10 @@ fn blitz_issue_88__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), ..Default::default() }, @@ -276,6 +308,10 @@ fn blitz_issue_88__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/border_center_child.rs b/tests/generated/flex/border_center_child.rs index 60ecc4bd6..00144471b 100644 --- a/tests/generated/flex/border_center_child.rs +++ b/tests/generated/flex/border_center_child.rs @@ -6,6 +6,7 @@ fn border_center_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn border_center_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -128,6 +133,7 @@ fn border_center_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -139,6 +145,10 @@ fn border_center_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/flex/border_container_match_child.rs b/tests/generated/flex/border_container_match_child.rs index 51c466733..9861e2ec2 100644 --- a/tests/generated/flex/border_container_match_child.rs +++ b/tests/generated/flex/border_container_match_child.rs @@ -6,6 +6,7 @@ fn border_container_match_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn border_container_match_child__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -123,6 +128,7 @@ fn border_container_match_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -135,6 +141,10 @@ fn border_container_match_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/border_flex_child.rs b/tests/generated/flex/border_flex_child.rs index e4fb1bf21..1a81875c2 100644 --- a/tests/generated/flex/border_flex_child.rs +++ b/tests/generated/flex/border_flex_child.rs @@ -6,6 +6,7 @@ fn border_flex_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -14,6 +15,10 @@ fn border_flex_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn border_flex_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -133,6 +139,10 @@ fn border_flex_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/border_no_child.rs b/tests/generated/flex/border_no_child.rs index 4f9372651..cc8e0585e 100644 --- a/tests/generated/flex/border_no_child.rs +++ b/tests/generated/flex/border_no_child.rs @@ -6,6 +6,7 @@ fn border_no_child__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -71,6 +72,7 @@ fn border_no_child__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/border_no_size.rs b/tests/generated/flex/border_no_size.rs index 019dd5d27..24a2b6cb1 100644 --- a/tests/generated/flex/border_no_size.rs +++ b/tests/generated/flex/border_no_size.rs @@ -7,6 +7,7 @@ fn border_no_size__border_box() { let node = taffy .new_leaf(taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -73,6 +74,7 @@ fn border_no_size__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/border_stretch_child.rs b/tests/generated/flex/border_stretch_child.rs index 4d33afe2e..3e1fa8db8 100644 --- a/tests/generated/flex/border_stretch_child.rs +++ b/tests/generated/flex/border_stretch_child.rs @@ -6,6 +6,7 @@ fn border_stretch_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -13,6 +14,10 @@ fn border_stretch_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn border_stretch_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -131,6 +137,10 @@ fn border_stretch_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/child_min_max_width_flexing.rs b/tests/generated/flex/child_min_max_width_flexing.rs index c03101c0e..6e3fa2632 100644 --- a/tests/generated/flex/child_min_max_width_flexing.rs +++ b/tests/generated/flex/child_min_max_width_flexing.rs @@ -6,6 +6,7 @@ fn child_min_max_width_flexing__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(0f32), @@ -15,6 +16,7 @@ fn child_min_max_width_flexing__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), @@ -25,6 +27,10 @@ fn child_min_max_width_flexing__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), @@ -169,6 +175,7 @@ fn child_min_max_width_flexing__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(0f32), @@ -179,6 +186,7 @@ fn child_min_max_width_flexing__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), @@ -190,6 +198,10 @@ fn child_min_max_width_flexing__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), diff --git a/tests/generated/flex/child_with_padding_align_end.rs b/tests/generated/flex/child_with_padding_align_end.rs index 723b6ef6d..05c7a629a 100644 --- a/tests/generated/flex/child_with_padding_align_end.rs +++ b/tests/generated/flex/child_with_padding_align_end.rs @@ -6,6 +6,7 @@ fn child_with_padding_align_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -23,6 +24,10 @@ fn child_with_padding_align_end__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { @@ -135,6 +140,7 @@ fn child_with_padding_align_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -153,6 +159,10 @@ fn child_with_padding_align_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { diff --git a/tests/generated/flex/container_with_unsized_child.rs b/tests/generated/flex/container_with_unsized_child.rs index 835a7f9cc..ae267f59e 100644 --- a/tests/generated/flex/container_with_unsized_child.rs +++ b/tests/generated/flex/container_with_unsized_child.rs @@ -4,10 +4,19 @@ fn container_with_unsized_child__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -116,12 +125,20 @@ fn container_with_unsized_child__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/content_size.rs b/tests/generated/flex/content_size.rs index 77892fa7c..cd4b09161 100644 --- a/tests/generated/flex/content_size.rs +++ b/tests/generated/flex/content_size.rs @@ -8,6 +8,10 @@ fn content_size__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -22,6 +26,10 @@ fn content_size__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(30f32) }, ..Default::default() }, @@ -189,6 +197,10 @@ fn content_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -204,6 +216,10 @@ fn content_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(30f32) }, ..Default::default() }, diff --git a/tests/generated/flex/content_size_with_border.rs b/tests/generated/flex/content_size_with_border.rs index 2891249e9..ec2a2df12 100644 --- a/tests/generated/flex/content_size_with_border.rs +++ b/tests/generated/flex/content_size_with_border.rs @@ -6,121 +6,241 @@ fn content_size_with_border__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node3 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node4 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node5 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node6 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node7 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node8 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node9 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node10 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node11 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node12 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node13 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node14 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node15 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node16 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node17 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node18 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node19 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); @@ -1043,121 +1163,261 @@ fn content_size_with_border__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node3 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node4 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node5 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node6 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node7 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node8 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node9 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node10 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node11 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node12 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node13 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node14 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node15 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node16 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node17 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node18 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); let node19 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("XXXXXXXXXXXXXXXXXXXX", crate::WritingMode::Horizontal), ) .unwrap(); diff --git a/tests/generated/flex/display_none.rs b/tests/generated/flex/display_none.rs index ba2a758a4..c5d5d130d 100644 --- a/tests/generated/flex/display_none.rs +++ b/tests/generated/flex/display_none.rs @@ -4,13 +4,28 @@ fn display_none__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { display: taffy::style::Display::None, flex_grow: 1f32, ..Default::default() }) + .new_leaf(taffy::style::Style { + display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -160,6 +175,7 @@ fn display_none__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -168,6 +184,7 @@ fn display_none__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -176,6 +193,10 @@ fn display_none__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_absolute_child.rs b/tests/generated/flex/display_none_absolute_child.rs index a318dec65..0ce771caa 100644 --- a/tests/generated/flex/display_none_absolute_child.rs +++ b/tests/generated/flex/display_none_absolute_child.rs @@ -4,11 +4,18 @@ fn display_none_absolute_child__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -20,6 +27,10 @@ fn display_none_absolute_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -169,6 +180,7 @@ fn display_none_absolute_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -178,6 +190,7 @@ fn display_none_absolute_child__content_box() { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -190,6 +203,10 @@ fn display_none_absolute_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_fixed_size.rs b/tests/generated/flex/display_none_fixed_size.rs index 6e64424ac..d4a384426 100644 --- a/tests/generated/flex/display_none_fixed_size.rs +++ b/tests/generated/flex/display_none_fixed_size.rs @@ -4,10 +4,17 @@ fn display_none_fixed_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +25,10 @@ fn display_none_fixed_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -167,6 +178,7 @@ fn display_none_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -175,6 +187,7 @@ fn display_none_fixed_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -186,6 +199,10 @@ fn display_none_fixed_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_only_node.rs b/tests/generated/flex/display_none_only_node.rs index 6eb8bce43..6a0ba46d6 100644 --- a/tests/generated/flex/display_none_only_node.rs +++ b/tests/generated/flex/display_none_only_node.rs @@ -7,6 +7,7 @@ fn display_none_only_node__border_box() { let node = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -71,6 +72,7 @@ fn display_none_only_node__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_with_child.rs b/tests/generated/flex/display_none_with_child.rs index 2c13ea9b8..65f2a63a9 100644 --- a/tests/generated/flex/display_none_with_child.rs +++ b/tests/generated/flex/display_none_with_child.rs @@ -6,6 +6,7 @@ fn display_none_with_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -14,6 +15,7 @@ fn display_none_with_child__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -26,6 +28,10 @@ fn display_none_with_child__border_box() { taffy::style::Style { display: taffy::style::Display::None, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -36,6 +42,7 @@ fn display_none_with_child__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -45,6 +52,10 @@ fn display_none_with_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -278,6 +289,7 @@ fn display_none_with_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -287,6 +299,7 @@ fn display_none_with_child__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -300,6 +313,10 @@ fn display_none_with_child__content_box() { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -311,6 +328,7 @@ fn display_none_with_child__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -321,6 +339,10 @@ fn display_none_with_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_with_margin.rs b/tests/generated/flex/display_none_with_margin.rs index 3539fb311..10a673104 100644 --- a/tests/generated/flex/display_none_with_margin.rs +++ b/tests/generated/flex/display_none_with_margin.rs @@ -7,6 +7,7 @@ fn display_none_with_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -20,10 +21,20 @@ fn display_none_with_margin__border_box() { ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -174,6 +185,7 @@ fn display_none_with_margin__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -190,6 +202,7 @@ fn display_none_with_margin__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -198,6 +211,10 @@ fn display_none_with_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_with_position.rs b/tests/generated/flex/display_none_with_position.rs index 612ce7ec1..5cb6b30e5 100644 --- a/tests/generated/flex/display_none_with_position.rs +++ b/tests/generated/flex/display_none_with_position.rs @@ -4,10 +4,17 @@ fn display_none_with_position__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(10f32), bottom: auto() }, ..Default::default() @@ -16,6 +23,10 @@ fn display_none_with_position__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -165,6 +176,7 @@ fn display_none_with_position__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -173,6 +185,7 @@ fn display_none_with_position__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(10f32), bottom: auto() }, ..Default::default() @@ -182,6 +195,10 @@ fn display_none_with_position__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/display_none_with_position_absolute.rs b/tests/generated/flex/display_none_with_position_absolute.rs index 6470ba977..34ab46924 100644 --- a/tests/generated/flex/display_none_with_position_absolute.rs +++ b/tests/generated/flex/display_none_with_position_absolute.rs @@ -8,6 +8,7 @@ fn display_none_with_position_absolute__border_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -18,6 +19,10 @@ fn display_none_with_position_absolute__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn display_none_with_position_absolute__content_box() { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -135,6 +141,10 @@ fn display_none_with_position_absolute__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 1e0fdc049..3494987d3 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 @@ -6,6 +6,7 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -18,6 +19,10 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ taffy::style::Style { position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }, @@ -187,6 +192,7 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -200,6 +206,10 @@ fn do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent_ box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_absolute_overflow_clip.rs b/tests/generated/flex/flex_absolute_overflow_clip.rs index 15539523a..8c17fd0e5 100644 --- a/tests/generated/flex/flex_absolute_overflow_clip.rs +++ b/tests/generated/flex/flex_absolute_overflow_clip.rs @@ -8,6 +8,10 @@ fn flex_absolute_overflow_clip__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -27,7 +31,6 @@ fn flex_absolute_overflow_clip__border_box() { .new_with_children( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -152,6 +155,10 @@ fn flex_absolute_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -172,7 +179,6 @@ fn flex_absolute_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/flex_absolute_overflow_hidden.rs b/tests/generated/flex/flex_absolute_overflow_hidden.rs index 41eec243f..162cb8b98 100644 --- a/tests/generated/flex/flex_absolute_overflow_hidden.rs +++ b/tests/generated/flex/flex_absolute_overflow_hidden.rs @@ -8,6 +8,10 @@ fn flex_absolute_overflow_hidden__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -155,6 +159,10 @@ fn flex_absolute_overflow_hidden__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_absolute_overflow_scroll.rs b/tests/generated/flex/flex_absolute_overflow_scroll.rs index f85acf00f..be0f56635 100644 --- a/tests/generated/flex/flex_absolute_overflow_scroll.rs +++ b/tests/generated/flex/flex_absolute_overflow_scroll.rs @@ -8,6 +8,10 @@ fn flex_absolute_overflow_scroll__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -155,6 +159,10 @@ fn flex_absolute_overflow_scroll__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_absolute_overflow_visible.rs b/tests/generated/flex/flex_absolute_overflow_visible.rs index 6b9d5db5a..6400ec285 100644 --- a/tests/generated/flex/flex_absolute_overflow_visible.rs +++ b/tests/generated/flex/flex_absolute_overflow_visible.rs @@ -8,6 +8,10 @@ fn flex_absolute_overflow_visible__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -26,6 +30,10 @@ fn flex_absolute_overflow_visible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -150,6 +158,10 @@ fn flex_absolute_overflow_visible__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -169,6 +181,10 @@ fn flex_absolute_overflow_visible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), 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 6fce54ea3..781100fe8 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 @@ -6,6 +6,7 @@ fn flex_basis_and_main_dimen_set_when_flexing__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn flex_basis_and_main_dimen_set_when_flexing__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { @@ -29,6 +31,10 @@ fn flex_basis_and_main_dimen_set_when_flexing__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -169,6 +175,7 @@ fn flex_basis_and_main_dimen_set_when_flexing__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { @@ -181,6 +188,7 @@ fn flex_basis_and_main_dimen_set_when_flexing__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { @@ -194,6 +202,10 @@ fn flex_basis_and_main_dimen_set_when_flexing__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_basis_flex_grow_column.rs b/tests/generated/flex/flex_basis_flex_grow_column.rs index 2e2523e8c..ed87fb5a6 100644 --- a/tests/generated/flex/flex_basis_flex_grow_column.rs +++ b/tests/generated/flex/flex_basis_flex_grow_column.rs @@ -6,16 +6,27 @@ fn flex_basis_flex_grow_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -159,6 +170,7 @@ fn flex_basis_flex_grow_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() @@ -167,6 +179,7 @@ fn flex_basis_flex_grow_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -176,6 +189,10 @@ fn flex_basis_flex_grow_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_basis_flex_grow_row.rs b/tests/generated/flex/flex_basis_flex_grow_row.rs index d642a6370..dfc8c804e 100644 --- a/tests/generated/flex/flex_basis_flex_grow_row.rs +++ b/tests/generated/flex/flex_basis_flex_grow_row.rs @@ -6,15 +6,26 @@ fn flex_basis_flex_grow_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -170,6 +181,7 @@ fn flex_basis_flex_grow_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() @@ -178,6 +190,7 @@ fn flex_basis_flex_grow_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -186,6 +199,10 @@ fn flex_basis_flex_grow_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_basis_flex_shrink_column.rs b/tests/generated/flex/flex_basis_flex_shrink_column.rs index 46cb587ab..3974a78e3 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_column.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_column.rs @@ -6,17 +6,26 @@ fn flex_basis_flex_shrink_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_basis: taffy::style::Dimension::from_length(50f32), + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -160,6 +169,7 @@ fn flex_basis_flex_shrink_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() }) @@ -167,6 +177,7 @@ fn flex_basis_flex_shrink_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) @@ -176,6 +187,10 @@ fn flex_basis_flex_shrink_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_basis_flex_shrink_row.rs b/tests/generated/flex/flex_basis_flex_shrink_row.rs index df72fe8f7..1becc5e39 100644 --- a/tests/generated/flex/flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/flex_basis_flex_shrink_row.rs @@ -6,16 +6,25 @@ fn flex_basis_flex_shrink_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_basis: taffy::style::Dimension::from_length(50f32), + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -171,6 +180,7 @@ fn flex_basis_flex_shrink_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() }) @@ -178,6 +188,7 @@ fn flex_basis_flex_shrink_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }) @@ -186,6 +197,10 @@ fn flex_basis_flex_shrink_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 51864ce91..4601ad204 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_column.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_column.rs @@ -6,6 +6,7 @@ fn flex_basis_larger_than_content_column__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn flex_basis_larger_than_content_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -27,6 +32,10 @@ fn flex_basis_larger_than_content_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, @@ -173,6 +182,7 @@ fn flex_basis_larger_than_content_column__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(10f32), @@ -185,6 +195,10 @@ fn flex_basis_larger_than_content_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -196,6 +210,10 @@ fn flex_basis_larger_than_content_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, 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 96409c3ca..143da75a9 100644 --- a/tests/generated/flex/flex_basis_larger_than_content_row.rs +++ b/tests/generated/flex/flex_basis_larger_than_content_row.rs @@ -6,6 +6,7 @@ fn flex_basis_larger_than_content_row__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_larger_than_content_row__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -26,6 +31,10 @@ fn flex_basis_larger_than_content_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -178,6 +187,7 @@ fn flex_basis_larger_than_content_row__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(100f32), @@ -190,6 +200,10 @@ fn flex_basis_larger_than_content_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -200,6 +214,10 @@ fn flex_basis_larger_than_content_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_basis_overrides_main_size.rs b/tests/generated/flex/flex_basis_overrides_main_size.rs index b4f4753fc..16d6492bc 100644 --- a/tests/generated/flex/flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/flex_basis_overrides_main_size.rs @@ -6,6 +6,7 @@ fn flex_basis_overrides_main_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, @@ -14,6 +15,7 @@ fn flex_basis_overrides_main_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -21,6 +23,7 @@ fn flex_basis_overrides_main_size__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -29,6 +32,10 @@ fn flex_basis_overrides_main_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -229,6 +236,7 @@ fn flex_basis_overrides_main_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, @@ -238,6 +246,7 @@ fn flex_basis_overrides_main_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -246,6 +255,7 @@ fn flex_basis_overrides_main_size__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -255,6 +265,10 @@ fn flex_basis_overrides_main_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 03bfc119e..4bf601159 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 @@ -6,6 +6,7 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(60f32), ..Default::default() @@ -26,6 +31,7 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -47,6 +57,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__border_bo let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(60f32), ..Default::default() @@ -311,6 +330,7 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -334,6 +358,10 @@ fn flex_basis_slightly_smaller_then_content_with_flex_grow_large_size__content_b .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 0fa8299ae..427f07af7 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_column.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_column.rs @@ -6,6 +6,7 @@ fn flex_basis_smaller_than_content_column__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_than_content_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -27,6 +32,10 @@ fn flex_basis_smaller_than_content_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, @@ -179,6 +188,7 @@ fn flex_basis_smaller_than_content_column__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -191,6 +201,10 @@ fn flex_basis_smaller_than_content_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -202,6 +216,10 @@ fn flex_basis_smaller_than_content_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, 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 da966bf80..cd0c6ee1c 100644 --- a/tests/generated/flex/flex_basis_smaller_than_content_row.rs +++ b/tests/generated/flex/flex_basis_smaller_than_content_row.rs @@ -6,6 +6,7 @@ fn flex_basis_smaller_than_content_row__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_than_content_row__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -26,6 +31,10 @@ fn flex_basis_smaller_than_content_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -178,6 +187,7 @@ fn flex_basis_smaller_than_content_row__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -190,6 +200,10 @@ fn flex_basis_smaller_than_content_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -200,6 +214,10 @@ fn flex_basis_smaller_than_content_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 c68236ba4..6706d6772 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_than_main_dimen_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,10 @@ fn flex_basis_smaller_than_main_dimen_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, @@ -119,6 +124,7 @@ fn flex_basis_smaller_than_main_dimen_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -132,6 +138,10 @@ fn flex_basis_smaller_than_main_dimen_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, 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 edc9a3086..199bc1f9d 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_than_main_dimen_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_than_main_dimen_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -118,6 +123,7 @@ fn flex_basis_smaller_than_main_dimen_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(10f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -130,6 +136,10 @@ fn flex_basis_smaller_than_main_dimen_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 d3bdebe04..6afe294ef 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -26,6 +31,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -47,6 +57,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -311,6 +330,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -334,6 +358,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_large_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 b6ae090cf..b292f2d00 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -26,6 +31,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -47,6 +57,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -311,6 +330,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -334,6 +358,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_small_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }, 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 cf334dff4..1fa856315 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -26,6 +31,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -44,7 +54,18 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__border_box( &[node10], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -281,6 +302,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -293,6 +315,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -303,6 +329,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -315,6 +342,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -324,7 +355,14 @@ fn flex_basis_smaller_then_content_with_flex_grow_unconstraint_size__content_box .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); 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 27ce58842..c90a27739 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 @@ -6,6 +6,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -26,6 +31,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -47,6 +57,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__border_box() let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -311,6 +330,7 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -334,6 +358,10 @@ fn flex_basis_smaller_then_content_with_flex_grow_very_large_size__content_box() .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_basis_unconstraint_column.rs b/tests/generated/flex/flex_basis_unconstraint_column.rs index 8eba77d47..ac81ffed4 100644 --- a/tests/generated/flex/flex_basis_unconstraint_column.rs +++ b/tests/generated/flex/flex_basis_unconstraint_column.rs @@ -6,6 +6,7 @@ fn flex_basis_unconstraint_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -13,7 +14,14 @@ fn flex_basis_unconstraint_column__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -112,6 +120,7 @@ fn flex_basis_unconstraint_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -122,6 +131,10 @@ fn flex_basis_unconstraint_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/flex/flex_basis_unconstraint_row.rs b/tests/generated/flex/flex_basis_unconstraint_row.rs index 2be1a33c8..7ac844d40 100644 --- a/tests/generated/flex/flex_basis_unconstraint_row.rs +++ b/tests/generated/flex/flex_basis_unconstraint_row.rs @@ -6,12 +6,24 @@ fn flex_basis_unconstraint_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -113,6 +125,7 @@ fn flex_basis_unconstraint_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -120,7 +133,14 @@ fn flex_basis_unconstraint_row__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 1d4def79d..450be5721 100644 --- a/tests/generated/flex/flex_basis_zero_undefined_main_size.rs +++ b/tests/generated/flex/flex_basis_zero_undefined_main_size.rs @@ -6,6 +6,7 @@ fn flex_basis_zero_undefined_main_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,13 +18,28 @@ fn flex_basis_zero_undefined_main_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() }, &[node00], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -164,6 +180,7 @@ fn flex_basis_zero_undefined_main_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(50f32), @@ -176,6 +193,10 @@ fn flex_basis_zero_undefined_main_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() }, @@ -184,7 +205,14 @@ fn flex_basis_zero_undefined_main_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/flex_column_relative_all_sides.rs b/tests/generated/flex/flex_column_relative_all_sides.rs index 7a7a13471..57c50d332 100644 --- a/tests/generated/flex/flex_column_relative_all_sides.rs +++ b/tests/generated/flex/flex_column_relative_all_sides.rs @@ -6,6 +6,7 @@ fn flex_column_relative_all_sides__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -20,6 +21,10 @@ fn flex_column_relative_all_sides__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn flex_column_relative_all_sides__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -139,6 +145,10 @@ fn flex_column_relative_all_sides__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_direction_column.rs b/tests/generated/flex/flex_direction_column.rs index 275c01b2d..7664468d9 100644 --- a/tests/generated/flex/flex_direction_column.rs +++ b/tests/generated/flex/flex_direction_column.rs @@ -6,18 +6,21 @@ fn flex_direction_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn flex_direction_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -208,6 +215,7 @@ fn flex_direction_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -215,6 +223,7 @@ fn flex_direction_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -222,6 +231,7 @@ fn flex_direction_column__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -231,6 +241,10 @@ fn flex_direction_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_direction_column_no_height.rs b/tests/generated/flex/flex_direction_column_no_height.rs index cf9c3ee7d..8111c8bb0 100644 --- a/tests/generated/flex/flex_direction_column_no_height.rs +++ b/tests/generated/flex/flex_direction_column_no_height.rs @@ -6,18 +6,21 @@ fn flex_direction_column_no_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn flex_direction_column_no_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -205,6 +212,7 @@ fn flex_direction_column_no_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -212,6 +220,7 @@ fn flex_direction_column_no_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -219,6 +228,7 @@ fn flex_direction_column_no_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -228,6 +238,10 @@ fn flex_direction_column_no_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_direction_column_reverse.rs b/tests/generated/flex/flex_direction_column_reverse.rs index 54ec64aa1..e4814e96b 100644 --- a/tests/generated/flex/flex_direction_column_reverse.rs +++ b/tests/generated/flex/flex_direction_column_reverse.rs @@ -6,18 +6,21 @@ fn flex_direction_column_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn flex_direction_column_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -208,6 +215,7 @@ fn flex_direction_column_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -215,6 +223,7 @@ fn flex_direction_column_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -222,6 +231,7 @@ fn flex_direction_column_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -231,6 +241,10 @@ fn flex_direction_column_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 7273a9484..d0574e6eb 100644 --- a/tests/generated/flex/flex_direction_column_reverse_no_height.rs +++ b/tests/generated/flex/flex_direction_column_reverse_no_height.rs @@ -6,18 +6,21 @@ fn flex_direction_column_reverse_no_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn flex_direction_column_reverse_no_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -205,6 +212,7 @@ fn flex_direction_column_reverse_no_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -212,6 +220,7 @@ fn flex_direction_column_reverse_no_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -219,6 +228,7 @@ fn flex_direction_column_reverse_no_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -228,6 +238,10 @@ fn flex_direction_column_reverse_no_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_direction_row.rs b/tests/generated/flex/flex_direction_row.rs index 639813d4f..e9ec8cc95 100644 --- a/tests/generated/flex/flex_direction_row.rs +++ b/tests/generated/flex/flex_direction_row.rs @@ -6,18 +6,21 @@ fn flex_direction_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn flex_direction_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -225,6 +232,7 @@ fn flex_direction_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -232,6 +240,7 @@ fn flex_direction_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -239,6 +248,7 @@ fn flex_direction_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -247,6 +257,10 @@ fn flex_direction_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_direction_row_no_width.rs b/tests/generated/flex/flex_direction_row_no_width.rs index d9d59750e..ca79a13b4 100644 --- a/tests/generated/flex/flex_direction_row_no_width.rs +++ b/tests/generated/flex/flex_direction_row_no_width.rs @@ -6,18 +6,21 @@ fn flex_direction_row_no_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn flex_direction_row_no_width__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, @@ -222,6 +229,7 @@ fn flex_direction_row_no_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -229,6 +237,7 @@ fn flex_direction_row_no_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -236,6 +245,7 @@ fn flex_direction_row_no_width__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -244,6 +254,10 @@ fn flex_direction_row_no_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, diff --git a/tests/generated/flex/flex_direction_row_reverse.rs b/tests/generated/flex/flex_direction_row_reverse.rs index 44cb78ae6..a4826c572 100644 --- a/tests/generated/flex/flex_direction_row_reverse.rs +++ b/tests/generated/flex/flex_direction_row_reverse.rs @@ -6,18 +6,21 @@ fn flex_direction_row_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -26,6 +29,10 @@ fn flex_direction_row_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::RowReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn flex_direction_row_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn flex_direction_row_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn flex_direction_row_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn flex_direction_row_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::RowReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_grow_0_min_size.rs b/tests/generated/flex/flex_grow_0_min_size.rs index b519db231..acbfc8745 100644 --- a/tests/generated/flex/flex_grow_0_min_size.rs +++ b/tests/generated/flex/flex_grow_0_min_size.rs @@ -7,6 +7,10 @@ fn flex_grow_0_min_size__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -18,6 +22,10 @@ fn flex_grow_0_min_size__border_box() { let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -29,6 +37,10 @@ fn flex_grow_0_min_size__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -40,6 +52,10 @@ fn flex_grow_0_min_size__border_box() { let node3 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -52,6 +68,10 @@ fn flex_grow_0_min_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(100f32), @@ -280,6 +300,10 @@ fn flex_grow_0_min_size__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -292,6 +316,10 @@ fn flex_grow_0_min_size__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -304,6 +332,10 @@ fn flex_grow_0_min_size__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -316,6 +348,10 @@ fn flex_grow_0_min_size__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -329,6 +365,10 @@ fn flex_grow_0_min_size__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_grow_child.rs b/tests/generated/flex/flex_grow_child.rs index 7861111ae..15ba892c6 100644 --- a/tests/generated/flex/flex_grow_child.rs +++ b/tests/generated/flex/flex_grow_child.rs @@ -6,13 +6,25 @@ fn flex_grow_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -114,6 +126,7 @@ fn flex_grow_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -122,7 +135,14 @@ fn flex_grow_child__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 ab2101945..cc9ff3f4e 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 @@ -6,6 +6,7 @@ fn flex_grow_flex_basis_percent_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(0f32), @@ -16,6 +17,7 @@ fn flex_grow_flex_basis_percent_min_max__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), @@ -30,6 +32,10 @@ fn flex_grow_flex_basis_percent_min_max__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), height: auto() }, ..Default::default() }, @@ -170,6 +176,7 @@ fn flex_grow_flex_basis_percent_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(0f32), @@ -181,6 +188,7 @@ fn flex_grow_flex_basis_percent_min_max__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), @@ -196,6 +204,10 @@ fn flex_grow_flex_basis_percent_min_max__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(120f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/flex_grow_height_maximized.rs b/tests/generated/flex/flex_grow_height_maximized.rs index e22f61858..088241326 100644 --- a/tests/generated/flex/flex_grow_height_maximized.rs +++ b/tests/generated/flex/flex_grow_height_maximized.rs @@ -6,6 +6,7 @@ fn flex_grow_height_maximized__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -13,6 +14,7 @@ fn flex_grow_height_maximized__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn flex_grow_height_maximized__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -33,6 +39,10 @@ fn flex_grow_height_maximized__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(500f32), @@ -233,6 +243,7 @@ fn flex_grow_height_maximized__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -241,6 +252,7 @@ fn flex_grow_height_maximized__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -250,6 +262,10 @@ fn flex_grow_height_maximized__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -263,6 +279,10 @@ fn flex_grow_height_maximized__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(500f32), 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 be08bb9aa..3eddb49be 100644 --- a/tests/generated/flex/flex_grow_in_at_most_container.rs +++ b/tests/generated/flex/flex_grow_in_at_most_container.rs @@ -6,15 +6,31 @@ fn flex_grow_in_at_most_container__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() }) .unwrap(); - let node0 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node00]).unwrap(); + let node0 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node00], + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -159,6 +175,7 @@ fn flex_grow_in_at_most_container__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -166,7 +183,14 @@ fn flex_grow_in_at_most_container__content_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -174,6 +198,10 @@ fn flex_grow_in_at_most_container__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 d38ac16c0..bc496392b 100644 --- a/tests/generated/flex/flex_grow_less_than_factor_one.rs +++ b/tests/generated/flex/flex_grow_less_than_factor_one.rs @@ -6,19 +6,36 @@ fn flex_grow_less_than_factor_one__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.2f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(40f32), ..Default::default() }) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { flex_grow: 0.2f32, flex_shrink: 0f32, ..Default::default() }).unwrap(); - let node2 = - taffy.new_leaf(taffy::style::Style { flex_grow: 0.4f32, flex_shrink: 0f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 0.2f32, + flex_shrink: 0f32, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 0.4f32, + flex_shrink: 0f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(200f32), @@ -219,6 +236,7 @@ fn flex_grow_less_than_factor_one__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.2f32, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(40f32), @@ -228,6 +246,7 @@ fn flex_grow_less_than_factor_one__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.2f32, flex_shrink: 0f32, ..Default::default() @@ -236,6 +255,7 @@ fn flex_grow_less_than_factor_one__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.4f32, flex_shrink: 0f32, ..Default::default() @@ -245,6 +265,10 @@ fn flex_grow_less_than_factor_one__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/flex_grow_root_minimized.rs b/tests/generated/flex/flex_grow_root_minimized.rs index 92dd7251f..248208da2 100644 --- a/tests/generated/flex/flex_grow_root_minimized.rs +++ b/tests/generated/flex/flex_grow_root_minimized.rs @@ -6,6 +6,7 @@ fn flex_grow_root_minimized__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -13,6 +14,7 @@ fn flex_grow_root_minimized__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn flex_grow_root_minimized__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -33,6 +39,10 @@ fn flex_grow_root_minimized__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -232,6 +242,7 @@ fn flex_grow_root_minimized__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -240,6 +251,7 @@ fn flex_grow_root_minimized__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -249,6 +261,10 @@ fn flex_grow_root_minimized__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -262,6 +278,10 @@ fn flex_grow_root_minimized__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, diff --git a/tests/generated/flex/flex_grow_shrink_at_most.rs b/tests/generated/flex/flex_grow_shrink_at_most.rs index 2b6858686..83ed4ef2e 100644 --- a/tests/generated/flex/flex_grow_shrink_at_most.rs +++ b/tests/generated/flex/flex_grow_shrink_at_most.rs @@ -4,12 +4,33 @@ fn flex_grow_shrink_at_most__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); + let node0 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node00], + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -165,6 +186,7 @@ fn flex_grow_shrink_at_most__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -172,7 +194,14 @@ fn flex_grow_shrink_at_most__content_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -180,6 +209,10 @@ fn flex_grow_shrink_at_most__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_grow_to_min.rs b/tests/generated/flex/flex_grow_to_min.rs index 9a6187882..02354b4d4 100644 --- a/tests/generated/flex/flex_grow_to_min.rs +++ b/tests/generated/flex/flex_grow_to_min.rs @@ -4,10 +4,17 @@ fn flex_grow_to_min__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = - taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -16,6 +23,10 @@ fn flex_grow_to_min__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -158,6 +169,7 @@ fn flex_grow_to_min__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -166,6 +178,7 @@ fn flex_grow_to_min__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -175,6 +188,10 @@ fn flex_grow_to_min__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, 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 e31832d44..742b1a591 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_column.rs @@ -6,6 +6,7 @@ fn flex_grow_within_constrained_max_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() @@ -13,6 +14,7 @@ fn flex_grow_within_constrained_max_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn flex_grow_within_constrained_max_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -162,6 +168,7 @@ fn flex_grow_within_constrained_max_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() @@ -170,6 +177,7 @@ fn flex_grow_within_constrained_max_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -179,6 +187,10 @@ fn flex_grow_within_constrained_max_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() 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 4f0cf6bd5..8f284dda9 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_row.rs @@ -6,6 +6,7 @@ fn flex_grow_within_constrained_max_row__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() @@ -13,6 +14,7 @@ fn flex_grow_within_constrained_max_row__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -20,6 +22,10 @@ fn flex_grow_within_constrained_max_row__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -31,6 +37,10 @@ fn flex_grow_within_constrained_max_row__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -228,6 +238,7 @@ fn flex_grow_within_constrained_max_row__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() @@ -236,6 +247,7 @@ fn flex_grow_within_constrained_max_row__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -244,6 +256,10 @@ fn flex_grow_within_constrained_max_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -256,6 +272,10 @@ fn flex_grow_within_constrained_max_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, 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 f0c109565..2deda7c5c 100644 --- a/tests/generated/flex/flex_grow_within_constrained_max_width.rs +++ b/tests/generated/flex/flex_grow_within_constrained_max_width.rs @@ -6,6 +6,7 @@ fn flex_grow_within_constrained_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -14,6 +15,10 @@ fn flex_grow_within_constrained_max_width__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn flex_grow_within_constrained_max_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -173,6 +182,7 @@ fn flex_grow_within_constrained_max_width__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -182,6 +192,10 @@ fn flex_grow_within_constrained_max_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() }, @@ -193,6 +207,10 @@ fn flex_grow_within_constrained_max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), 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 b264c7421..2bb9d3b2a 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_column.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_column.rs @@ -4,9 +4,16 @@ fn flex_grow_within_constrained_min_column__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -15,6 +22,10 @@ fn flex_grow_within_constrained_min_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, @@ -155,6 +166,7 @@ fn flex_grow_within_constrained_min_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -162,6 +174,7 @@ fn flex_grow_within_constrained_min_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -171,6 +184,10 @@ fn flex_grow_within_constrained_min_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }, 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 a41b18d80..23c792ca6 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 @@ -4,9 +4,16 @@ fn flex_grow_within_constrained_min_max_column__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -15,6 +22,10 @@ fn flex_grow_within_constrained_min_max_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -156,6 +167,7 @@ fn flex_grow_within_constrained_min_max_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -163,6 +175,7 @@ fn flex_grow_within_constrained_min_max_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) @@ -172,6 +185,10 @@ fn flex_grow_within_constrained_min_max_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() 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 c2ef49a54..c1a4c54f9 100644 --- a/tests/generated/flex/flex_grow_within_constrained_min_row.rs +++ b/tests/generated/flex/flex_grow_within_constrained_min_row.rs @@ -4,9 +4,16 @@ fn flex_grow_within_constrained_min_row__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -14,6 +21,10 @@ fn flex_grow_within_constrained_min_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -167,6 +178,7 @@ fn flex_grow_within_constrained_min_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -174,6 +186,7 @@ fn flex_grow_within_constrained_min_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -182,6 +195,10 @@ fn flex_grow_within_constrained_min_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/flex_grow_within_max_width.rs b/tests/generated/flex/flex_grow_within_max_width.rs index a04006bef..7febfd819 100644 --- a/tests/generated/flex/flex_grow_within_max_width.rs +++ b/tests/generated/flex/flex_grow_within_max_width.rs @@ -6,6 +6,7 @@ fn flex_grow_within_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -14,6 +15,10 @@ fn flex_grow_within_max_width__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -24,6 +29,10 @@ fn flex_grow_within_max_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -173,6 +182,7 @@ fn flex_grow_within_max_width__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() @@ -182,6 +192,10 @@ fn flex_grow_within_max_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -193,6 +207,10 @@ fn flex_grow_within_max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_inflow_overflow_clip.rs b/tests/generated/flex/flex_inflow_overflow_clip.rs index 6f55ae396..207ca56f1 100644 --- a/tests/generated/flex/flex_inflow_overflow_clip.rs +++ b/tests/generated/flex/flex_inflow_overflow_clip.rs @@ -7,6 +7,10 @@ fn flex_inflow_overflow_clip__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -20,7 +24,6 @@ fn flex_inflow_overflow_clip__border_box() { .new_with_children( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -144,6 +147,10 @@ fn flex_inflow_overflow_clip__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -158,7 +165,6 @@ fn flex_inflow_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/flex_inflow_overflow_hidden.rs b/tests/generated/flex/flex_inflow_overflow_hidden.rs index e2a9deadf..26d9b37b2 100644 --- a/tests/generated/flex/flex_inflow_overflow_hidden.rs +++ b/tests/generated/flex/flex_inflow_overflow_hidden.rs @@ -7,6 +7,10 @@ fn flex_inflow_overflow_hidden__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -147,6 +151,10 @@ fn flex_inflow_overflow_hidden__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_inflow_overflow_scroll.rs b/tests/generated/flex/flex_inflow_overflow_scroll.rs index b1ba5869c..14d5bb360 100644 --- a/tests/generated/flex/flex_inflow_overflow_scroll.rs +++ b/tests/generated/flex/flex_inflow_overflow_scroll.rs @@ -7,6 +7,10 @@ fn flex_inflow_overflow_scroll__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -147,6 +151,10 @@ fn flex_inflow_overflow_scroll__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/flex_inflow_overflow_visible.rs b/tests/generated/flex/flex_inflow_overflow_visible.rs index bb1389bbd..fbf6e7903 100644 --- a/tests/generated/flex/flex_inflow_overflow_visible.rs +++ b/tests/generated/flex/flex_inflow_overflow_visible.rs @@ -7,6 +7,10 @@ fn flex_inflow_overflow_visible__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -19,6 +23,10 @@ fn flex_inflow_overflow_visible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -142,6 +150,10 @@ fn flex_inflow_overflow_visible__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -155,6 +167,10 @@ fn flex_inflow_overflow_visible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/flex_root_ignored.rs b/tests/generated/flex/flex_root_ignored.rs index 213075348..a57020e1e 100644 --- a/tests/generated/flex/flex_root_ignored.rs +++ b/tests/generated/flex/flex_root_ignored.rs @@ -6,6 +6,7 @@ fn flex_root_ignored__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -13,6 +14,7 @@ fn flex_root_ignored__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -21,6 +23,10 @@ fn flex_root_ignored__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, @@ -175,6 +181,7 @@ fn flex_root_ignored__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(200f32), ..Default::default() @@ -183,6 +190,7 @@ fn flex_root_ignored__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) @@ -192,6 +200,10 @@ fn flex_root_ignored__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(500f32) }, diff --git a/tests/generated/flex/flex_row_relative_all_sides.rs b/tests/generated/flex/flex_row_relative_all_sides.rs index a9709ed26..b9a6e475b 100644 --- a/tests/generated/flex/flex_row_relative_all_sides.rs +++ b/tests/generated/flex/flex_row_relative_all_sides.rs @@ -6,6 +6,7 @@ fn flex_row_relative_all_sides__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -19,6 +20,10 @@ fn flex_row_relative_all_sides__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -129,6 +134,7 @@ fn flex_row_relative_all_sides__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -143,6 +149,10 @@ fn flex_row_relative_all_sides__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 c53baa1ef..3ebfdb4a6 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 @@ -6,6 +6,7 @@ fn flex_shrink_by_outer_margin_with_max_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn flex_shrink_by_outer_margin_with_max_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, ..Default::default() @@ -120,6 +125,7 @@ fn flex_shrink_by_outer_margin_with_max_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -133,6 +139,10 @@ fn flex_shrink_by_outer_margin_with_max_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, ..Default::default() 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 cd554142b..089da6fe2 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 @@ -6,6 +6,7 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -29,6 +31,10 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -184,6 +190,7 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -196,6 +203,7 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -209,6 +217,10 @@ fn flex_shrink_flex_grow_child_flex_shrink_other_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), diff --git a/tests/generated/flex/flex_shrink_flex_grow_row.rs b/tests/generated/flex/flex_shrink_flex_grow_row.rs index bcddb0e3e..9a68a8894 100644 --- a/tests/generated/flex/flex_shrink_flex_grow_row.rs +++ b/tests/generated/flex/flex_shrink_flex_grow_row.rs @@ -6,6 +6,7 @@ fn flex_shrink_flex_grow_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn flex_shrink_flex_grow_row__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -29,6 +31,10 @@ fn flex_shrink_flex_grow_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -184,6 +190,7 @@ fn flex_shrink_flex_grow_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -196,6 +203,7 @@ fn flex_shrink_flex_grow_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0f32, flex_shrink: 1f32, size: taffy::geometry::Size { @@ -209,6 +217,10 @@ fn flex_shrink_flex_grow_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), diff --git a/tests/generated/flex/flex_shrink_to_zero.rs b/tests/generated/flex/flex_shrink_to_zero.rs index 6a4267c81..ea9f4757c 100644 --- a/tests/generated/flex/flex_shrink_to_zero.rs +++ b/tests/generated/flex/flex_shrink_to_zero.rs @@ -6,6 +6,7 @@ fn flex_shrink_to_zero__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -16,6 +17,7 @@ fn flex_shrink_to_zero__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -26,6 +28,7 @@ fn flex_shrink_to_zero__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -37,6 +40,10 @@ fn flex_shrink_to_zero__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(75f32), height: auto() }, ..Default::default() }, @@ -216,6 +223,7 @@ fn flex_shrink_to_zero__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -227,6 +235,7 @@ fn flex_shrink_to_zero__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -238,6 +247,7 @@ fn flex_shrink_to_zero__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -250,6 +260,10 @@ fn flex_shrink_to_zero__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(75f32), height: auto() }, ..Default::default() }, 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 e32a20cd8..e40cb77f5 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 @@ -6,12 +6,14 @@ fn flex_wrap_align_stretch_fits_one_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -20,6 +22,10 @@ fn flex_wrap_align_stretch_fits_one_row__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(100f32), @@ -175,6 +181,7 @@ fn flex_wrap_align_stretch_fits_one_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -182,6 +189,7 @@ fn flex_wrap_align_stretch_fits_one_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) @@ -191,6 +199,10 @@ fn flex_wrap_align_stretch_fits_one_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(100f32), 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 0a3fe531f..27979854c 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 @@ -6,6 +6,7 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(55f32), height: auto() }, @@ -14,6 +15,7 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(55f32), height: auto() }, @@ -24,6 +26,10 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -164,6 +170,7 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(55f32), height: auto() }, @@ -173,6 +180,7 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(55f32), height: auto() }, @@ -184,6 +192,10 @@ fn flex_wrap_children_with_min_main_overriding_flex_basis__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 046aed878..d0fe13b6d 100644 --- a/tests/generated/flex/flex_wrap_wrap_to_child_height.rs +++ b/tests/generated/flex/flex_wrap_wrap_to_child_height.rs @@ -6,6 +6,7 @@ fn flex_wrap_wrap_to_child_height__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn flex_wrap_wrap_to_child_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -27,6 +32,10 @@ fn flex_wrap_wrap_to_child_height__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, @@ -35,6 +44,7 @@ fn flex_wrap_wrap_to_child_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -44,7 +54,14 @@ fn flex_wrap_wrap_to_child_height__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -290,6 +307,7 @@ fn flex_wrap_wrap_to_child_height__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -302,6 +320,10 @@ fn flex_wrap_wrap_to_child_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -313,6 +335,10 @@ fn flex_wrap_wrap_to_child_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), ..Default::default() }, @@ -322,6 +348,7 @@ fn flex_wrap_wrap_to_child_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -334,6 +361,10 @@ fn flex_wrap_wrap_to_child_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/flex/gap_column_gap_child_margins.rs b/tests/generated/flex/gap_column_gap_child_margins.rs index 87a65bb3f..fb84f3597 100644 --- a/tests/generated/flex/gap_column_gap_child_margins.rs +++ b/tests/generated/flex/gap_column_gap_child_margins.rs @@ -6,6 +6,7 @@ fn gap_column_gap_child_margins__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -15,6 +16,7 @@ fn gap_column_gap_child_margins__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -24,6 +26,7 @@ fn gap_column_gap_child_margins__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -34,6 +37,10 @@ fn gap_column_gap_child_margins__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), @@ -235,6 +242,7 @@ fn gap_column_gap_child_margins__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -245,6 +253,7 @@ fn gap_column_gap_child_margins__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -255,6 +264,7 @@ fn gap_column_gap_child_margins__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -266,6 +276,10 @@ fn gap_column_gap_child_margins__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), 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 4ccdd5f3b..e93a474c9 100644 --- a/tests/generated/flex/gap_column_gap_determines_parent_width.rs +++ b/tests/generated/flex/gap_column_gap_determines_parent_width.rs @@ -6,18 +6,21 @@ fn gap_column_gap_determines_parent_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_determines_parent_width__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -224,6 +231,7 @@ fn gap_column_gap_determines_parent_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -231,6 +239,7 @@ fn gap_column_gap_determines_parent_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -238,6 +247,7 @@ fn gap_column_gap_determines_parent_width__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: auto() }, ..Default::default() }) @@ -246,6 +256,10 @@ fn gap_column_gap_determines_parent_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, diff --git a/tests/generated/flex/gap_column_gap_flexible.rs b/tests/generated/flex/gap_column_gap_flexible.rs index b585d30ee..6899196a9 100644 --- a/tests/generated/flex/gap_column_gap_flexible.rs +++ b/tests/generated/flex/gap_column_gap_flexible.rs @@ -6,6 +6,7 @@ fn gap_column_gap_flexible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -14,6 +15,7 @@ fn gap_column_gap_flexible__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -22,6 +24,7 @@ fn gap_column_gap_flexible__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -31,6 +34,10 @@ fn gap_column_gap_flexible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), @@ -232,6 +239,7 @@ fn gap_column_gap_flexible__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -241,6 +249,7 @@ fn gap_column_gap_flexible__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -250,6 +259,7 @@ fn gap_column_gap_flexible__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -260,6 +270,10 @@ fn gap_column_gap_flexible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), 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 1ff2f1e81..2cbdabab9 100644 --- a/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_flexible_undefined_parent.rs @@ -6,6 +6,7 @@ fn gap_column_gap_flexible_undefined_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -14,6 +15,7 @@ fn gap_column_gap_flexible_undefined_parent__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -22,6 +24,7 @@ fn gap_column_gap_flexible_undefined_parent__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -31,6 +34,10 @@ fn gap_column_gap_flexible_undefined_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -229,6 +236,7 @@ fn gap_column_gap_flexible_undefined_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -238,6 +246,7 @@ fn gap_column_gap_flexible_undefined_parent__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -247,6 +256,7 @@ fn gap_column_gap_flexible_undefined_parent__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -257,6 +267,10 @@ fn gap_column_gap_flexible_undefined_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() diff --git a/tests/generated/flex/gap_column_gap_inflexible.rs b/tests/generated/flex/gap_column_gap_inflexible.rs index 149384e03..4515796ac 100644 --- a/tests/generated/flex/gap_column_gap_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_inflexible.rs @@ -6,18 +6,21 @@ fn gap_column_gap_inflexible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_inflexible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), @@ -226,6 +233,7 @@ fn gap_column_gap_inflexible__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn gap_column_gap_inflexible__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn gap_column_gap_inflexible__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn gap_column_gap_inflexible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), 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 b6d695fcc..02259c8c8 100644 --- a/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs +++ b/tests/generated/flex/gap_column_gap_inflexible_undefined_parent.rs @@ -6,18 +6,21 @@ fn gap_column_gap_inflexible_undefined_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_inflexible_undefined_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -223,6 +230,7 @@ fn gap_column_gap_inflexible_undefined_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -230,6 +238,7 @@ fn gap_column_gap_inflexible_undefined_parent__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -237,6 +246,7 @@ fn gap_column_gap_inflexible_undefined_parent__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -245,6 +255,10 @@ fn gap_column_gap_inflexible_undefined_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() diff --git a/tests/generated/flex/gap_column_gap_justify_center.rs b/tests/generated/flex/gap_column_gap_justify_center.rs index 00d636203..e5b52efed 100644 --- a/tests/generated/flex/gap_column_gap_justify_center.rs +++ b/tests/generated/flex/gap_column_gap_justify_center.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { 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 3f42226da..e7e29d110 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_end.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_end.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_flex_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_flex_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { 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 f184485fd..b8de298ed 100644 --- a/tests/generated/flex/gap_column_gap_justify_flex_start.rs +++ b/tests/generated/flex/gap_column_gap_justify_flex_start.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_flex_start__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_flex_start__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { 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 789555b90..73bc410d1 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_around.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_around.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_space_around__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_space_around__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_space_around__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_space_around__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_space_around__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_space_around__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { 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 919d89af4..8185de16c 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_between.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_between.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_space_between__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_space_between__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_space_between__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_space_between__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_space_between__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_space_between__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { 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 21d84d23f..be11cec4b 100644 --- a/tests/generated/flex/gap_column_gap_justify_space_evenly.rs +++ b/tests/generated/flex/gap_column_gap_justify_space_evenly.rs @@ -6,18 +6,21 @@ fn gap_column_gap_justify_space_evenly__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_justify_space_evenly__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { @@ -227,6 +234,7 @@ fn gap_column_gap_justify_space_evenly__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -234,6 +242,7 @@ fn gap_column_gap_justify_space_evenly__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -241,6 +250,7 @@ fn gap_column_gap_justify_space_evenly__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -249,6 +259,10 @@ fn gap_column_gap_justify_space_evenly__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { diff --git a/tests/generated/flex/gap_column_gap_mixed_flexible.rs b/tests/generated/flex/gap_column_gap_mixed_flexible.rs index 68c1131be..69469a6ae 100644 --- a/tests/generated/flex/gap_column_gap_mixed_flexible.rs +++ b/tests/generated/flex/gap_column_gap_mixed_flexible.rs @@ -6,12 +6,14 @@ fn gap_column_gap_mixed_flexible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -20,6 +22,7 @@ fn gap_column_gap_mixed_flexible__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -27,6 +30,10 @@ fn gap_column_gap_mixed_flexible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), @@ -228,6 +235,7 @@ fn gap_column_gap_mixed_flexible__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -235,6 +243,7 @@ fn gap_column_gap_mixed_flexible__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -244,6 +253,7 @@ fn gap_column_gap_mixed_flexible__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -252,6 +262,10 @@ fn gap_column_gap_mixed_flexible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), 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 dac729867..54cb950dc 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 @@ -6,6 +6,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -25,6 +27,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -36,6 +39,10 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.5f32), height: zero() }, ..Default::default() }, @@ -215,6 +222,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -226,6 +234,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -236,6 +245,7 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -248,6 +258,10 @@ fn gap_column_gap_percentage_cyclic_partially_shrinkable__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.5f32), height: zero() }, ..Default::default() }, 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 1fada954c..b4e420edb 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_shrinkable.rs @@ -6,6 +6,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -15,6 +16,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -24,6 +26,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -34,6 +37,10 @@ fn gap_column_gap_percentage_cyclic_shrinkable__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, ..Default::default() }, @@ -213,6 +220,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -223,6 +231,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -233,6 +242,7 @@ fn gap_column_gap_percentage_cyclic_shrinkable__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(40f32), @@ -244,6 +254,10 @@ fn gap_column_gap_percentage_cyclic_shrinkable__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, ..Default::default() }, 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 26674d708..e7d3790f9 100644 --- a/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs +++ b/tests/generated/flex/gap_column_gap_percentage_cyclic_unshrinkable.rs @@ -6,6 +6,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -26,6 +28,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -37,6 +40,10 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, ..Default::default() }, @@ -216,6 +223,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -227,6 +235,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -238,6 +247,7 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -250,6 +260,10 @@ fn gap_column_gap_percentage_cyclic_unshrinkable__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, ..Default::default() }, diff --git a/tests/generated/flex/gap_column_gap_percentage_flexible.rs b/tests/generated/flex/gap_column_gap_percentage_flexible.rs index 3b7775057..63c8db712 100644 --- a/tests/generated/flex/gap_column_gap_percentage_flexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_flexible.rs @@ -6,6 +6,7 @@ fn gap_column_gap_percentage_flexible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -14,6 +15,7 @@ fn gap_column_gap_percentage_flexible__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -22,6 +24,7 @@ fn gap_column_gap_percentage_flexible__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -31,6 +34,10 @@ fn gap_column_gap_percentage_flexible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.1f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -232,6 +239,7 @@ fn gap_column_gap_percentage_flexible__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -241,6 +249,7 @@ fn gap_column_gap_percentage_flexible__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -250,6 +259,7 @@ fn gap_column_gap_percentage_flexible__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -260,6 +270,10 @@ fn gap_column_gap_percentage_flexible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.1f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 ba89442c2..50543a7b2 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 @@ -6,6 +6,7 @@ fn gap_column_gap_percentage_flexible_with_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -14,6 +15,7 @@ fn gap_column_gap_percentage_flexible_with_padding__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -22,6 +24,7 @@ fn gap_column_gap_percentage_flexible_with_padding__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -31,6 +34,10 @@ fn gap_column_gap_percentage_flexible_with_padding__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.1f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -220,6 +227,7 @@ fn gap_column_gap_percentage_flexible_with_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -229,6 +237,7 @@ fn gap_column_gap_percentage_flexible_with_padding__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -238,6 +247,7 @@ fn gap_column_gap_percentage_flexible_with_padding__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -248,6 +258,10 @@ fn gap_column_gap_percentage_flexible_with_padding__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.1f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs index 31217a205..43e1f7149 100644 --- a/tests/generated/flex/gap_column_gap_percentage_inflexible.rs +++ b/tests/generated/flex/gap_column_gap_percentage_inflexible.rs @@ -6,18 +6,21 @@ fn gap_column_gap_percentage_inflexible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn gap_column_gap_percentage_inflexible__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn gap_column_gap_percentage_inflexible__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn gap_column_gap_percentage_inflexible__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn gap_column_gap_percentage_inflexible__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn gap_column_gap_percentage_inflexible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 631749a74..d04355e55 100644 --- a/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_gap_row_gap_wrapping.rs @@ -6,6 +6,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -60,6 +66,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -69,6 +76,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -78,6 +86,7 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .unwrap(); let node8 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -89,6 +98,10 @@ fn gap_column_gap_row_gap_wrapping__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -503,6 +516,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -513,6 +527,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -523,6 +538,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -533,6 +549,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -543,6 +560,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -553,6 +571,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -563,6 +582,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -573,6 +593,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -583,6 +604,7 @@ fn gap_column_gap_row_gap_wrapping__content_box() { let node8 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -595,6 +617,10 @@ fn gap_column_gap_row_gap_wrapping__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/gap_column_gap_start_index.rs b/tests/generated/flex/gap_column_gap_start_index.rs index 7a3c39c10..8b2bebf9e 100644 --- a/tests/generated/flex/gap_column_gap_start_index.rs +++ b/tests/generated/flex/gap_column_gap_start_index.rs @@ -7,6 +7,7 @@ fn gap_column_gap_start_index__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn gap_column_gap_start_index__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -25,6 +27,7 @@ fn gap_column_gap_start_index__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -34,6 +37,7 @@ fn gap_column_gap_start_index__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -45,6 +49,10 @@ fn gap_column_gap_start_index__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -265,6 +273,7 @@ fn gap_column_gap_start_index__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -275,6 +284,7 @@ fn gap_column_gap_start_index__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -285,6 +295,7 @@ fn gap_column_gap_start_index__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -295,6 +306,7 @@ fn gap_column_gap_start_index__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -307,6 +319,10 @@ fn gap_column_gap_start_index__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() 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 3cf8fd5b0..ee66aadce 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_center.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_center.rs @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_wrap_align_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_wrap_align_center__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_wrap_align_center__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_wrap_align_center__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_wrap_align_center__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -62,6 +68,10 @@ fn gap_column_gap_wrap_align_center__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -363,6 +373,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -373,6 +384,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -383,6 +395,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -393,6 +406,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +417,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -413,6 +428,7 @@ fn gap_column_gap_wrap_align_center__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -425,6 +441,10 @@ fn gap_column_gap_wrap_align_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 db726087c..7584fc771 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 @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -62,6 +68,10 @@ fn gap_column_gap_wrap_align_flex_end__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -363,6 +373,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -373,6 +384,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -383,6 +395,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -393,6 +406,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +417,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -413,6 +428,7 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -425,6 +441,10 @@ fn gap_column_gap_wrap_align_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 e901a6e68..0dc50b87c 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 @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -62,6 +68,10 @@ fn gap_column_gap_wrap_align_flex_start__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -363,6 +373,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -373,6 +384,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -383,6 +395,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -393,6 +406,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +417,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -413,6 +428,7 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -425,6 +441,10 @@ fn gap_column_gap_wrap_align_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 89bdcb8dd..66346711a 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 @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -62,6 +68,10 @@ fn gap_column_gap_wrap_align_space_around__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -363,6 +373,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -373,6 +384,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -383,6 +395,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -393,6 +406,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +417,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -413,6 +428,7 @@ fn gap_column_gap_wrap_align_space_around__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -425,6 +441,10 @@ fn gap_column_gap_wrap_align_space_around__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 5faa9d8d5..bbcd53eea 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 @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -62,6 +68,10 @@ fn gap_column_gap_wrap_align_space_between__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -363,6 +373,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -373,6 +384,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -383,6 +395,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -393,6 +406,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -403,6 +417,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -413,6 +428,7 @@ fn gap_column_gap_wrap_align_space_between__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -425,6 +441,10 @@ fn gap_column_gap_wrap_align_space_between__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 548b1b566..03998f6e8 100644 --- a/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs +++ b/tests/generated/flex/gap_column_gap_wrap_align_stretch.rs @@ -6,6 +6,7 @@ fn gap_column_gap_wrap_align_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn gap_column_gap_wrap_align_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -20,6 +22,7 @@ fn gap_column_gap_wrap_align_stretch__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -27,6 +30,7 @@ fn gap_column_gap_wrap_align_stretch__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -34,6 +38,7 @@ fn gap_column_gap_wrap_align_stretch__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -43,6 +48,10 @@ fn gap_column_gap_wrap_align_stretch__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), gap: taffy::geometry::Size { width: length(5f32), height: zero() }, size: taffy::geometry::Size { @@ -335,6 +344,7 @@ fn gap_column_gap_wrap_align_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -343,6 +353,7 @@ fn gap_column_gap_wrap_align_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -351,6 +362,7 @@ fn gap_column_gap_wrap_align_stretch__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -359,6 +371,7 @@ fn gap_column_gap_wrap_align_stretch__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -367,6 +380,7 @@ fn gap_column_gap_wrap_align_stretch__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -377,6 +391,10 @@ fn gap_column_gap_wrap_align_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), gap: taffy::geometry::Size { width: length(5f32), height: zero() }, size: taffy::geometry::Size { diff --git a/tests/generated/flex/gap_column_row_gap_wrapping.rs b/tests/generated/flex/gap_column_row_gap_wrapping.rs index 65bf590d4..00ad45144 100644 --- a/tests/generated/flex/gap_column_row_gap_wrapping.rs +++ b/tests/generated/flex/gap_column_row_gap_wrapping.rs @@ -6,6 +6,7 @@ fn gap_column_row_gap_wrapping__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -60,6 +66,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -69,6 +76,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -78,6 +86,7 @@ fn gap_column_row_gap_wrapping__border_box() { .unwrap(); let node8 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -89,6 +98,10 @@ fn gap_column_row_gap_wrapping__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -503,6 +516,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -513,6 +527,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -523,6 +538,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -533,6 +549,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -543,6 +560,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -553,6 +571,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -563,6 +582,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -573,6 +593,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -583,6 +604,7 @@ fn gap_column_row_gap_wrapping__content_box() { let node8 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -595,6 +617,10 @@ fn gap_column_row_gap_wrapping__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() 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 6b18e8282..74631561a 100644 --- a/tests/generated/flex/gap_row_gap_align_items_end.rs +++ b/tests/generated/flex/gap_row_gap_align_items_end.rs @@ -6,36 +6,42 @@ fn gap_row_gap_align_items_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -44,6 +50,10 @@ fn gap_row_gap_align_items_end__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { @@ -345,6 +355,7 @@ fn gap_row_gap_align_items_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -352,6 +363,7 @@ fn gap_row_gap_align_items_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -359,6 +371,7 @@ fn gap_row_gap_align_items_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -366,6 +379,7 @@ fn gap_row_gap_align_items_end__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -373,6 +387,7 @@ fn gap_row_gap_align_items_end__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -380,6 +395,7 @@ fn gap_row_gap_align_items_end__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -389,6 +405,10 @@ fn gap_row_gap_align_items_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, size: taffy::geometry::Size { 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 b5e91a716..1c316730a 100644 --- a/tests/generated/flex/gap_row_gap_align_items_stretch.rs +++ b/tests/generated/flex/gap_row_gap_align_items_stretch.rs @@ -6,36 +6,42 @@ fn gap_row_gap_align_items_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -44,6 +50,10 @@ fn gap_row_gap_align_items_stretch__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Stretch), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, @@ -346,6 +356,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -353,6 +364,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -360,6 +372,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -367,6 +380,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -374,6 +388,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -381,6 +396,7 @@ fn gap_row_gap_align_items_stretch__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -390,6 +406,10 @@ fn gap_row_gap_align_items_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), align_content: Some(taffy::style::AlignContent::Stretch), gap: taffy::geometry::Size { width: length(10f32), height: length(20f32) }, 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 4b139184b..b6b4f272e 100644 --- a/tests/generated/flex/gap_row_gap_column_child_margins.rs +++ b/tests/generated/flex/gap_row_gap_column_child_margins.rs @@ -6,6 +6,7 @@ fn gap_row_gap_column_child_margins__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -15,6 +16,7 @@ fn gap_row_gap_column_child_margins__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -24,6 +26,7 @@ fn gap_row_gap_column_child_margins__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -35,6 +38,10 @@ fn gap_row_gap_column_child_margins__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -218,6 +225,7 @@ fn gap_row_gap_column_child_margins__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -228,6 +236,7 @@ fn gap_row_gap_column_child_margins__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -238,6 +247,7 @@ fn gap_row_gap_column_child_margins__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -250,6 +260,10 @@ fn gap_row_gap_column_child_margins__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 8ba71208d..cdfba133d 100644 --- a/tests/generated/flex/gap_row_gap_determines_parent_height.rs +++ b/tests/generated/flex/gap_row_gap_determines_parent_height.rs @@ -6,18 +6,21 @@ fn gap_row_gap_determines_parent_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(30f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn gap_row_gap_determines_parent_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -207,6 +214,7 @@ fn gap_row_gap_determines_parent_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -214,6 +222,7 @@ fn gap_row_gap_determines_parent_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) @@ -221,6 +230,7 @@ fn gap_row_gap_determines_parent_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(30f32) }, ..Default::default() }) @@ -230,6 +240,10 @@ fn gap_row_gap_determines_parent_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, diff --git a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs index f774f29fa..aa5e02ce6 100644 --- a/tests/generated/flex/gap_row_gap_percentage_wrapping.rs +++ b/tests/generated/flex/gap_row_gap_percentage_wrapping.rs @@ -6,6 +6,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +36,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +46,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +56,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -60,6 +66,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -69,6 +76,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -78,6 +86,7 @@ fn gap_row_gap_percentage_wrapping__border_box() { .unwrap(); let node8 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -89,6 +98,10 @@ fn gap_row_gap_percentage_wrapping__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: percent(0.1f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -503,6 +516,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -513,6 +527,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -523,6 +538,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -533,6 +549,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -543,6 +560,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -553,6 +571,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -563,6 +582,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -573,6 +593,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -583,6 +604,7 @@ fn gap_row_gap_percentage_wrapping__content_box() { let node8 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -595,6 +617,10 @@ fn gap_row_gap_percentage_wrapping__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: percent(0.1f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() 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 4afc8287a..84ac20da5 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 @@ -6,6 +6,7 @@ fn gap_row_gap_row_wrap_child_margins__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(2f32), bottom: length(2f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn gap_row_gap_row_wrap_child_margins__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -20,6 +22,7 @@ fn gap_row_gap_row_wrap_child_margins__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(15f32), bottom: length(15f32) }, ..Default::default() @@ -29,6 +32,10 @@ fn gap_row_gap_row_wrap_child_margins__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -212,6 +219,7 @@ fn gap_row_gap_row_wrap_child_margins__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(2f32), bottom: length(2f32) }, ..Default::default() @@ -220,6 +228,7 @@ fn gap_row_gap_row_wrap_child_margins__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -228,6 +237,7 @@ fn gap_row_gap_row_wrap_child_margins__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(15f32), bottom: length(15f32) }, ..Default::default() @@ -238,6 +248,10 @@ fn gap_row_gap_row_wrap_child_margins__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: zero(), height: length(10f32) }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs index d749152f3..d23279aa3 100644 --- a/tests/generated/flex/intrinsic_sizing_cross_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_cross_size_column.rs @@ -6,7 +6,14 @@ fn intrinsic_sizing_cross_size_column__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -68,6 +75,10 @@ fn intrinsic_sizing_cross_size_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), diff --git a/tests/generated/flex/intrinsic_sizing_main_size_column.rs b/tests/generated/flex/intrinsic_sizing_main_size_column.rs index 69314ea08..162bbbea9 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column.rs @@ -6,7 +6,14 @@ fn intrinsic_sizing_main_size_column__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), ) .unwrap(); @@ -68,6 +75,10 @@ fn intrinsic_sizing_main_size_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), 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 ede6b81ed..e32795e2a 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_nested.rs @@ -6,13 +6,27 @@ fn intrinsic_sizing_main_size_column_nested__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -113,6 +127,10 @@ fn intrinsic_sizing_main_size_column_nested__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), @@ -123,6 +141,10 @@ fn intrinsic_sizing_main_size_column_nested__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 f0b4c4192..42b8125a9 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_column_wrap.rs @@ -6,13 +6,27 @@ fn intrinsic_sizing_main_size_column_wrap__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), ) .unwrap(); @@ -21,6 +35,10 @@ fn intrinsic_sizing_main_size_column_wrap__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], @@ -162,6 +180,10 @@ fn intrinsic_sizing_main_size_column_wrap__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), @@ -172,6 +194,10 @@ fn intrinsic_sizing_main_size_column_wrap__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Vertical), @@ -183,6 +209,10 @@ fn intrinsic_sizing_main_size_column_wrap__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs b/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs index 3b84dfaf6..079726338 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_min_size.rs @@ -7,6 +7,7 @@ fn intrinsic_sizing_main_size_min_size__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +26,10 @@ fn intrinsic_sizing_main_size_min_size__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), max_size: taffy::geometry::Size { @@ -47,6 +52,10 @@ fn intrinsic_sizing_main_size_min_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: taffy::style::Dimension::from_length(200f32), @@ -197,6 +206,7 @@ fn intrinsic_sizing_main_size_min_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -216,6 +226,10 @@ fn intrinsic_sizing_main_size_min_size__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), max_size: taffy::geometry::Size { @@ -239,6 +253,10 @@ fn intrinsic_sizing_main_size_min_size__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/intrinsic_sizing_main_size_row.rs b/tests/generated/flex/intrinsic_sizing_main_size_row.rs index fb8f4c803..a40d14b5d 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row.rs @@ -6,7 +6,13 @@ fn intrinsic_sizing_main_size_row__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -65,7 +71,14 @@ fn intrinsic_sizing_main_size_row__content_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); 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 727f3c0ad..35922ae07 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_nested.rs @@ -6,11 +6,28 @@ fn intrinsic_sizing_main_size_row_nested__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -105,13 +122,27 @@ fn intrinsic_sizing_main_size_row_nested__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 dc79f7026..405567bde 100644 --- a/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs +++ b/tests/generated/flex/intrinsic_sizing_main_size_row_wrap.rs @@ -6,19 +6,38 @@ fn intrinsic_sizing_main_size_row_wrap__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() }, + taffy::style::Style { + flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -155,13 +174,27 @@ fn intrinsic_sizing_main_size_row_wrap__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -170,6 +203,10 @@ fn intrinsic_sizing_main_size_row_wrap__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], diff --git a/tests/generated/flex/justify_content_column_center.rs b/tests/generated/flex/justify_content_column_center.rs index 4c79e2420..9c63a5c39 100644 --- a/tests/generated/flex/justify_content_column_center.rs +++ b/tests/generated/flex/justify_content_column_center.rs @@ -6,18 +6,21 @@ fn justify_content_column_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_center__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 65d1fe4b0..1626472e2 100644 --- a/tests/generated/flex/justify_content_column_center_negative_space.rs +++ b/tests/generated/flex/justify_content_column_center_negative_space.rs @@ -6,6 +6,7 @@ fn justify_content_column_center_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_center_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_center_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_center_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_center_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_center_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_center_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_center_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_center_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_center_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 0ad976798..2ec118822 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 @@ -6,6 +6,7 @@ fn justify_content_column_center_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_center_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_center_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_center_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_center_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_center_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_center_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_center_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_center_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_center_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_end.rs b/tests/generated/flex/justify_content_column_end.rs index 27cfa28c0..d7bc16d6d 100644 --- a/tests/generated/flex/justify_content_column_end.rs +++ b/tests/generated/flex/justify_content_column_end.rs @@ -6,18 +6,21 @@ fn justify_content_column_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_end__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 b5f737ff5..3a8a306b9 100644 --- a/tests/generated/flex/justify_content_column_end_negative_space.rs +++ b/tests/generated/flex/justify_content_column_end_negative_space.rs @@ -6,6 +6,7 @@ fn justify_content_column_end_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_end_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_end_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_end_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::End), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_end_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_end_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_end_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_end_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_end_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::End), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_end_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 9afbd2990..28e9c4f63 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 @@ -6,6 +6,7 @@ fn justify_content_column_end_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_end_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_end_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_end_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::End), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_end_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_end_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_end_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_end_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_end_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::End), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_end_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_end_reverse.rs b/tests/generated/flex/justify_content_column_end_reverse.rs index 2e6fa6bce..6aa59b3fe 100644 --- a/tests/generated/flex/justify_content_column_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_end_reverse.rs @@ -6,18 +6,21 @@ fn justify_content_column_end_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_end_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_end_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_end_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_end_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_end_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_column_flex_end.rs b/tests/generated/flex/justify_content_column_flex_end.rs index d5b92bf6a..28d7708f1 100644 --- a/tests/generated/flex/justify_content_column_flex_end.rs +++ b/tests/generated/flex/justify_content_column_flex_end.rs @@ -6,18 +6,21 @@ fn justify_content_column_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_flex_end__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 42a65e8c6..f880a5a80 100644 --- a/tests/generated/flex/justify_content_column_flex_end_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_end_reverse.rs @@ -6,18 +6,21 @@ fn justify_content_column_flex_end_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_flex_end_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_flex_end_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_flex_end_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_flex_end_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_flex_end_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_column_flex_start.rs b/tests/generated/flex/justify_content_column_flex_start.rs index cf2e60f1d..dbec8620a 100644 --- a/tests/generated/flex/justify_content_column_flex_start.rs +++ b/tests/generated/flex/justify_content_column_flex_start.rs @@ -6,18 +6,21 @@ fn justify_content_column_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_flex_start__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 6585aa247..87d3e3414 100644 --- a/tests/generated/flex/justify_content_column_flex_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_flex_start_reverse.rs @@ -6,18 +6,21 @@ fn justify_content_column_flex_start_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_flex_start_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_flex_start_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_flex_start_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_flex_start_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_flex_start_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 1cd2e3636..ce3ab299d 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 @@ -6,6 +6,7 @@ fn justify_content_column_max_height_and_margin__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn justify_content_column_max_height_and_margin__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, @@ -26,7 +31,18 @@ fn justify_content_column_max_height_and_margin__border_box() { &[node00], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -167,6 +183,7 @@ fn justify_content_column_max_height_and_margin__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -179,6 +196,10 @@ fn justify_content_column_max_height_and_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(80f32) }, @@ -190,7 +211,14 @@ fn justify_content_column_max_height_and_margin__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 00628e0b5..c4e92c660 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 @@ -6,6 +6,7 @@ fn justify_content_column_min_height_and_margin__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn justify_content_column_min_height_and_margin__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(100f32), bottom: zero() }, @@ -25,7 +30,18 @@ fn justify_content_column_min_height_and_margin__border_box() { &[node00], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -166,6 +182,7 @@ fn justify_content_column_min_height_and_margin__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -178,6 +195,10 @@ fn justify_content_column_min_height_and_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(100f32), bottom: zero() }, @@ -188,7 +209,14 @@ fn justify_content_column_min_height_and_margin__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 6e7d265c0..909e7ea74 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 @@ -6,6 +6,7 @@ fn justify_content_column_min_height_and_margin_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn justify_content_column_min_height_and_margin_bottom__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -120,6 +125,7 @@ fn justify_content_column_min_height_and_margin_bottom__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -133,6 +139,10 @@ fn justify_content_column_min_height_and_margin_bottom__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() 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 8f0f2ba13..21380d1ea 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 @@ -6,6 +6,7 @@ fn justify_content_column_min_height_and_margin_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn justify_content_column_min_height_and_margin_top__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -120,6 +125,7 @@ fn justify_content_column_min_height_and_margin_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -133,6 +139,10 @@ fn justify_content_column_min_height_and_margin_top__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() diff --git a/tests/generated/flex/justify_content_column_space_around.rs b/tests/generated/flex/justify_content_column_space_around.rs index 608542b39..646788d47 100644 --- a/tests/generated/flex/justify_content_column_space_around.rs +++ b/tests/generated/flex/justify_content_column_space_around.rs @@ -6,18 +6,21 @@ fn justify_content_column_space_around__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_space_around__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_space_around__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_space_around__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_space_around__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_space_around__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 1b9fa2f07..4a4d105ed 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_around_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_around_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_around_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_around_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_space_around_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_space_around_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_space_around_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_space_around_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_space_around_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_space_around_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 5c04fd269..6079ab9d4 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_space_around_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_space_around_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_space_between.rs b/tests/generated/flex/justify_content_column_space_between.rs index b910a480e..25a99596d 100644 --- a/tests/generated/flex/justify_content_column_space_between.rs +++ b/tests/generated/flex/justify_content_column_space_between.rs @@ -6,18 +6,21 @@ fn justify_content_column_space_between__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_space_between__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_space_between__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_space_between__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_space_between__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_space_between__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 db66b1ebd..56024b596 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_between_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_between_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_between_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_between_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_space_between_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_space_between_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_space_between_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_space_between_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_space_between_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_space_between_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 01826212a..c616f5aad 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_space_between_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_space_between_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_space_evenly.rs b/tests/generated/flex/justify_content_column_space_evenly.rs index a7ca69d05..4cf56db59 100644 --- a/tests/generated/flex/justify_content_column_space_evenly.rs +++ b/tests/generated/flex/justify_content_column_space_evenly.rs @@ -6,18 +6,21 @@ fn justify_content_column_space_evenly__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_space_evenly__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_space_evenly__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_space_evenly__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_space_evenly__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_space_evenly__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 a5f8eb5bc..fa82daed4 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_evenly_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_evenly_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_evenly_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_evenly_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_space_evenly_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_space_evenly_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_space_evenly_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_space_evenly_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_space_evenly_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_space_evenly_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 358011b7f..1e82932ca 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 @@ -6,6 +6,7 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_space_evenly_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_space_evenly_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_start.rs b/tests/generated/flex/justify_content_column_start.rs index f1a576154..940c8d906 100644 --- a/tests/generated/flex/justify_content_column_start.rs +++ b/tests/generated/flex/justify_content_column_start.rs @@ -6,18 +6,21 @@ fn justify_content_column_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_start__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 7d232dc82..a9e365311 100644 --- a/tests/generated/flex/justify_content_column_start_negative_space.rs +++ b/tests/generated/flex/justify_content_column_start_negative_space.rs @@ -6,6 +6,7 @@ fn justify_content_column_start_negative_space__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_start_negative_space__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_start_negative_space__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_start_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -52,6 +59,10 @@ fn justify_content_column_start_negative_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -297,6 +308,7 @@ fn justify_content_column_start_negative_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -308,6 +320,7 @@ fn justify_content_column_start_negative_space__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -319,6 +332,7 @@ fn justify_content_column_start_negative_space__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -333,6 +347,10 @@ fn justify_content_column_start_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, @@ -347,6 +365,10 @@ fn justify_content_column_start_negative_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), 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 4638ad3c8..ecf153806 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 @@ -6,6 +6,7 @@ fn justify_content_column_start_negative_space_gap__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -16,6 +17,7 @@ fn justify_content_column_start_negative_space_gap__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -26,6 +28,7 @@ fn justify_content_column_start_negative_space_gap__border_box() { .unwrap(); let node02 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -39,6 +42,10 @@ fn justify_content_column_start_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Start), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -53,6 +60,10 @@ fn justify_content_column_start_negative_space_gap__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), @@ -298,6 +309,7 @@ fn justify_content_column_start_negative_space_gap__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -309,6 +321,7 @@ fn justify_content_column_start_negative_space_gap__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -320,6 +333,7 @@ fn justify_content_column_start_negative_space_gap__content_box() { let node02 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.8f32), @@ -334,6 +348,10 @@ fn justify_content_column_start_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Start), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -349,6 +367,10 @@ fn justify_content_column_start_negative_space_gap__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/justify_content_column_start_reverse.rs b/tests/generated/flex/justify_content_column_start_reverse.rs index 235ab085b..f98a70d84 100644 --- a/tests/generated/flex/justify_content_column_start_reverse.rs +++ b/tests/generated/flex/justify_content_column_start_reverse.rs @@ -6,18 +6,21 @@ fn justify_content_column_start_reverse__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -26,6 +29,10 @@ fn justify_content_column_start_reverse__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -209,6 +216,7 @@ fn justify_content_column_start_reverse__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -216,6 +224,7 @@ fn justify_content_column_start_reverse__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -223,6 +232,7 @@ fn justify_content_column_start_reverse__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -232,6 +242,10 @@ fn justify_content_column_start_reverse__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::ColumnReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_min_max.rs b/tests/generated/flex/justify_content_min_max.rs index fa150175e..bcef03e9b 100644 --- a/tests/generated/flex/justify_content_min_max.rs +++ b/tests/generated/flex/justify_content_min_max.rs @@ -6,6 +6,7 @@ fn justify_content_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,10 @@ fn justify_content_min_max__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, @@ -121,6 +126,7 @@ fn justify_content_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(60f32), @@ -133,6 +139,10 @@ fn justify_content_min_max__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, 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 b8ed11066..840f09f5c 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 @@ -6,6 +6,7 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__borde let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), @@ -17,6 +18,10 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__borde let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, @@ -33,7 +38,14 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__borde .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_content: Some(taffy::style::AlignContent::Stretch), + ..Default::default() + }, &[node00], ) .unwrap(); @@ -41,6 +53,10 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__borde .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1000f32), @@ -260,6 +276,7 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__conte let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), @@ -272,6 +289,10 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__conte .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, @@ -290,6 +311,10 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__conte .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -301,6 +326,10 @@ fn justify_content_min_width_with_padding_child_width_greater_than_parent__conte taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1000f32), 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 7b1315b20..534899f9f 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 @@ -6,6 +6,7 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__border_ let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(199f32), @@ -17,6 +18,10 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__border_ let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, @@ -33,7 +38,14 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__border_ .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + align_content: Some(taffy::style::AlignContent::Stretch), + ..Default::default() + }, &[node00], ) .unwrap(); @@ -41,6 +53,10 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__border_ .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1080f32), @@ -260,6 +276,7 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__content let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(199f32), @@ -272,6 +289,10 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__content .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, @@ -290,6 +311,10 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__content .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), ..Default::default() }, @@ -301,6 +326,10 @@ fn justify_content_min_width_with_padding_child_width_lower_than_parent__content taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1080f32), diff --git a/tests/generated/flex/justify_content_overflow_min_max.rs b/tests/generated/flex/justify_content_overflow_min_max.rs index 8e3b09f8f..6bf4e4af2 100644 --- a/tests/generated/flex/justify_content_overflow_min_max.rs +++ b/tests/generated/flex/justify_content_overflow_min_max.rs @@ -6,6 +6,7 @@ fn justify_content_overflow_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -16,6 +17,7 @@ fn justify_content_overflow_min_max__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -26,6 +28,7 @@ fn justify_content_overflow_min_max__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -38,6 +41,10 @@ fn justify_content_overflow_min_max__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(110f32) }, @@ -219,6 +226,7 @@ fn justify_content_overflow_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -230,6 +238,7 @@ fn justify_content_overflow_min_max__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -241,6 +250,7 @@ fn justify_content_overflow_min_max__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -254,6 +264,10 @@ fn justify_content_overflow_min_max__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(110f32) }, diff --git a/tests/generated/flex/justify_content_row_center.rs b/tests/generated/flex/justify_content_row_center.rs index fc056d91c..9660f3d66 100644 --- a/tests/generated/flex/justify_content_row_center.rs +++ b/tests/generated/flex/justify_content_row_center.rs @@ -6,18 +6,21 @@ fn justify_content_row_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn justify_content_row_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn justify_content_row_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn justify_content_row_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn justify_content_row_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_row_flex_end.rs b/tests/generated/flex/justify_content_row_flex_end.rs index fe2362e3a..eb21d7017 100644 --- a/tests/generated/flex/justify_content_row_flex_end.rs +++ b/tests/generated/flex/justify_content_row_flex_end.rs @@ -6,18 +6,21 @@ fn justify_content_row_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_flex_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn justify_content_row_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn justify_content_row_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn justify_content_row_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn justify_content_row_flex_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_row_flex_start.rs b/tests/generated/flex/justify_content_row_flex_start.rs index c8af0ed6b..af42a673d 100644 --- a/tests/generated/flex/justify_content_row_flex_start.rs +++ b/tests/generated/flex/justify_content_row_flex_start.rs @@ -6,18 +6,21 @@ fn justify_content_row_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_flex_start__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn justify_content_row_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn justify_content_row_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn justify_content_row_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn justify_content_row_flex_start__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 6630dc4b0..0ad3cb02b 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 @@ -6,6 +6,7 @@ fn justify_content_row_max_width_and_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn justify_content_row_max_width_and_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, @@ -120,6 +125,7 @@ fn justify_content_row_max_width_and_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -132,6 +138,10 @@ fn justify_content_row_max_width_and_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, 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 f56f9abd6..d697d7764 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 @@ -6,6 +6,7 @@ fn justify_content_row_min_width_and_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn justify_content_row_min_width_and_margin__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -119,6 +124,7 @@ fn justify_content_row_min_width_and_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -131,6 +137,10 @@ fn justify_content_row_min_width_and_margin__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/justify_content_row_space_around.rs b/tests/generated/flex/justify_content_row_space_around.rs index 29ffbc749..af8b9dd10 100644 --- a/tests/generated/flex/justify_content_row_space_around.rs +++ b/tests/generated/flex/justify_content_row_space_around.rs @@ -6,18 +6,21 @@ fn justify_content_row_space_around__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_space_around__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn justify_content_row_space_around__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn justify_content_row_space_around__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn justify_content_row_space_around__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn justify_content_row_space_around__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_row_space_between.rs b/tests/generated/flex/justify_content_row_space_between.rs index dcb4fc400..314c6a1c7 100644 --- a/tests/generated/flex/justify_content_row_space_between.rs +++ b/tests/generated/flex/justify_content_row_space_between.rs @@ -6,18 +6,21 @@ fn justify_content_row_space_between__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_space_between__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -226,6 +233,7 @@ fn justify_content_row_space_between__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -233,6 +241,7 @@ fn justify_content_row_space_between__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -240,6 +249,7 @@ fn justify_content_row_space_between__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) @@ -248,6 +258,10 @@ fn justify_content_row_space_between__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/justify_content_row_space_evenly.rs b/tests/generated/flex/justify_content_row_space_evenly.rs index 2cede727f..c6ab68741 100644 --- a/tests/generated/flex/justify_content_row_space_evenly.rs +++ b/tests/generated/flex/justify_content_row_space_evenly.rs @@ -6,18 +6,21 @@ fn justify_content_row_space_evenly__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -25,6 +28,10 @@ fn justify_content_row_space_evenly__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -208,6 +215,7 @@ fn justify_content_row_space_evenly__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -215,6 +223,7 @@ fn justify_content_row_space_evenly__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -222,6 +231,7 @@ fn justify_content_row_space_evenly__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -230,6 +240,10 @@ fn justify_content_row_space_evenly__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_and_flex_column.rs b/tests/generated/flex/margin_and_flex_column.rs index c3d27a57f..80521fb4d 100644 --- a/tests/generated/flex/margin_and_flex_column.rs +++ b/tests/generated/flex/margin_and_flex_column.rs @@ -6,6 +6,7 @@ fn margin_and_flex_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,10 @@ fn margin_and_flex_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn margin_and_flex_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -129,6 +135,10 @@ fn margin_and_flex_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_and_flex_row.rs b/tests/generated/flex/margin_and_flex_row.rs index 2b463aad8..f610a8e73 100644 --- a/tests/generated/flex/margin_and_flex_row.rs +++ b/tests/generated/flex/margin_and_flex_row.rs @@ -6,6 +6,7 @@ fn margin_and_flex_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(10f32), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -14,6 +15,10 @@ fn margin_and_flex_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn margin_and_flex_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(10f32), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -133,6 +139,10 @@ fn margin_and_flex_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_and_stretch_column.rs b/tests/generated/flex/margin_and_stretch_column.rs index 075517317..2e808aafb 100644 --- a/tests/generated/flex/margin_and_stretch_column.rs +++ b/tests/generated/flex/margin_and_stretch_column.rs @@ -6,6 +6,7 @@ fn margin_and_stretch_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(10f32), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -15,6 +16,10 @@ fn margin_and_stretch_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn margin_and_stretch_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: length(10f32), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -135,6 +141,10 @@ fn margin_and_stretch_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_and_stretch_row.rs b/tests/generated/flex/margin_and_stretch_row.rs index deecca1a0..89344c79f 100644 --- a/tests/generated/flex/margin_and_stretch_row.rs +++ b/tests/generated/flex/margin_and_stretch_row.rs @@ -6,6 +6,7 @@ fn margin_and_stretch_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -14,6 +15,10 @@ fn margin_and_stretch_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -118,6 +123,7 @@ fn margin_and_stretch_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: length(10f32) }, ..Default::default() @@ -127,6 +133,10 @@ fn margin_and_stretch_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_auto_bottom.rs b/tests/generated/flex/margin_auto_bottom.rs index 2849563b5..44aac57e2 100644 --- a/tests/generated/flex/margin_auto_bottom.rs +++ b/tests/generated/flex/margin_auto_bottom.rs @@ -6,6 +6,7 @@ fn margin_auto_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_bottom__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_bottom__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_bottom__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_bottom__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_bottom__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_bottom_and_top.rs b/tests/generated/flex/margin_auto_bottom_and_top.rs index 4b604de93..9a015216d 100644 --- a/tests/generated/flex/margin_auto_bottom_and_top.rs +++ b/tests/generated/flex/margin_auto_bottom_and_top.rs @@ -6,6 +6,7 @@ fn margin_auto_bottom_and_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_bottom_and_top__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_bottom_and_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_bottom_and_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_bottom_and_top__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_bottom_and_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 cb17adf25..88d93dd9c 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 @@ -6,6 +6,7 @@ fn margin_auto_bottom_and_top_justify_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_bottom_and_top_justify_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_bottom_and_top_justify_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_bottom_and_top_justify_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_bottom_and_top_justify_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_bottom_and_top_justify_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_left.rs b/tests/generated/flex/margin_auto_left.rs index 3af33b682..2b8a70976 100644 --- a/tests/generated/flex/margin_auto_left.rs +++ b/tests/generated/flex/margin_auto_left.rs @@ -6,6 +6,7 @@ fn margin_auto_left__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_left__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_left__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_left__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_left__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_left__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_left_and_right.rs b/tests/generated/flex/margin_auto_left_and_right.rs index 639a054fa..b129928e1 100644 --- a/tests/generated/flex/margin_auto_left_and_right.rs +++ b/tests/generated/flex/margin_auto_left_and_right.rs @@ -6,6 +6,7 @@ fn margin_auto_left_and_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_left_and_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_left_and_right__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -174,6 +180,7 @@ fn margin_auto_left_and_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -190,6 +197,7 @@ fn margin_auto_left_and_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -201,6 +209,10 @@ fn margin_auto_left_and_right__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 d00900baa..b1aa589e9 100644 --- a/tests/generated/flex/margin_auto_left_and_right_column.rs +++ b/tests/generated/flex/margin_auto_left_and_right_column.rs @@ -6,6 +6,7 @@ fn margin_auto_left_and_right_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_left_and_right_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_left_and_right_column__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_left_and_right_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_left_and_right_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_left_and_right_column__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 8c7ab7f92..92597a071 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 @@ -6,6 +6,7 @@ fn margin_auto_left_and_right_column_and_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_left_and_right_column_and_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_left_and_right_column_and_center__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_left_and_right_column_and_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_left_and_right_column_and_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_left_and_right_column_and_center__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 321db2f48..968a9d5dd 100644 --- a/tests/generated/flex/margin_auto_left_and_right_stretch.rs +++ b/tests/generated/flex/margin_auto_left_and_right_stretch.rs @@ -6,6 +6,7 @@ fn margin_auto_left_and_right_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_left_and_right_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_left_and_right_stretch__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_left_and_right_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_left_and_right_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_left_and_right_stretch__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 a31428287..40bd33a78 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 @@ -6,6 +6,7 @@ fn margin_auto_left_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -22,6 +23,10 @@ fn margin_auto_left_child_bigger_than_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn margin_auto_left_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -144,6 +150,10 @@ fn margin_auto_left_child_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), 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 30fb6a41c..aa1592acd 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 @@ -6,6 +6,7 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -22,6 +23,10 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -144,6 +150,10 @@ fn margin_auto_left_fix_right_child_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), 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 800020292..64a5ddbda 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 @@ -6,6 +6,7 @@ fn margin_auto_left_right_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -22,6 +23,10 @@ fn margin_auto_left_right_child_bigger_than_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn margin_auto_left_right_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -144,6 +150,10 @@ fn margin_auto_left_right_child_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), diff --git a/tests/generated/flex/margin_auto_left_stretching_child.rs b/tests/generated/flex/margin_auto_left_stretching_child.rs index 333575d72..cb9a1bdbf 100644 --- a/tests/generated/flex/margin_auto_left_stretching_child.rs +++ b/tests/generated/flex/margin_auto_left_stretching_child.rs @@ -6,6 +6,7 @@ fn margin_auto_left_stretching_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -20,6 +21,7 @@ fn margin_auto_left_stretching_child__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -30,6 +32,10 @@ fn margin_auto_left_stretching_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -174,6 +180,7 @@ fn margin_auto_left_stretching_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -189,6 +196,7 @@ fn margin_auto_left_stretching_child__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -200,6 +208,10 @@ fn margin_auto_left_stretching_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_multiple_children_column.rs b/tests/generated/flex/margin_auto_multiple_children_column.rs index 26eb7cd3c..3edb81d2a 100644 --- a/tests/generated/flex/margin_auto_multiple_children_column.rs +++ b/tests/generated/flex/margin_auto_multiple_children_column.rs @@ -6,6 +6,7 @@ fn margin_auto_multiple_children_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_multiple_children_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -36,6 +38,7 @@ fn margin_auto_multiple_children_column__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -47,6 +50,10 @@ fn margin_auto_multiple_children_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -230,6 +237,7 @@ fn margin_auto_multiple_children_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -246,6 +254,7 @@ fn margin_auto_multiple_children_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -262,6 +271,7 @@ fn margin_auto_multiple_children_column__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -274,6 +284,10 @@ fn margin_auto_multiple_children_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_multiple_children_row.rs b/tests/generated/flex/margin_auto_multiple_children_row.rs index a110b9a86..02caa4d77 100644 --- a/tests/generated/flex/margin_auto_multiple_children_row.rs +++ b/tests/generated/flex/margin_auto_multiple_children_row.rs @@ -6,6 +6,7 @@ fn margin_auto_multiple_children_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_multiple_children_row__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -36,6 +38,7 @@ fn margin_auto_multiple_children_row__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -46,6 +49,10 @@ fn margin_auto_multiple_children_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -229,6 +236,7 @@ fn margin_auto_multiple_children_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -245,6 +253,7 @@ fn margin_auto_multiple_children_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -261,6 +270,7 @@ fn margin_auto_multiple_children_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -272,6 +282,10 @@ fn margin_auto_multiple_children_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_right.rs b/tests/generated/flex/margin_auto_right.rs index 180357372..8a0e1cc08 100644 --- a/tests/generated/flex/margin_auto_right.rs +++ b/tests/generated/flex/margin_auto_right.rs @@ -6,6 +6,7 @@ fn margin_auto_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_right__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_right__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_right__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_right__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_top.rs b/tests/generated/flex/margin_auto_top.rs index a06ec207d..71d4ad0eb 100644 --- a/tests/generated/flex/margin_auto_top.rs +++ b/tests/generated/flex/margin_auto_top.rs @@ -6,6 +6,7 @@ fn margin_auto_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_top__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -31,6 +33,10 @@ fn margin_auto_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -175,6 +181,7 @@ fn margin_auto_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -191,6 +198,7 @@ fn margin_auto_top__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -202,6 +210,10 @@ fn margin_auto_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 e8e9c6da3..643c074ac 100644 --- a/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs +++ b/tests/generated/flex/margin_auto_top_and_bottom_stretch.rs @@ -6,6 +6,7 @@ fn margin_auto_top_and_bottom_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -21,6 +22,7 @@ fn margin_auto_top_and_bottom_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +34,10 @@ fn margin_auto_top_and_bottom_stretch__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -176,6 +182,7 @@ fn margin_auto_top_and_bottom_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -192,6 +199,7 @@ fn margin_auto_top_and_bottom_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -204,6 +212,10 @@ fn margin_auto_top_and_bottom_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_auto_top_stretching_child.rs b/tests/generated/flex/margin_auto_top_stretching_child.rs index 43c1f80f0..37520d7cf 100644 --- a/tests/generated/flex/margin_auto_top_stretching_child.rs +++ b/tests/generated/flex/margin_auto_top_stretching_child.rs @@ -6,6 +6,7 @@ fn margin_auto_top_stretching_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -20,6 +21,7 @@ fn margin_auto_top_stretching_child__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -30,6 +32,10 @@ fn margin_auto_top_stretching_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -174,6 +180,7 @@ fn margin_auto_top_stretching_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -189,6 +196,7 @@ fn margin_auto_top_stretching_child__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -200,6 +208,10 @@ fn margin_auto_top_stretching_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/margin_bottom.rs b/tests/generated/flex/margin_bottom.rs index 0f0f32490..63bea8df4 100644 --- a/tests/generated/flex/margin_bottom.rs +++ b/tests/generated/flex/margin_bottom.rs @@ -6,6 +6,7 @@ fn margin_bottom__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -15,6 +16,10 @@ fn margin_bottom__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -120,6 +125,7 @@ fn margin_bottom__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -130,6 +136,10 @@ fn margin_bottom__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 ed75ec8d9..035f46960 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 @@ -6,6 +6,7 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -22,6 +23,10 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), @@ -127,6 +132,7 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(72f32), height: taffy::style::Dimension::from_length(72f32), @@ -144,6 +150,10 @@ fn margin_fix_left_auto_right_child_bigger_than_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), diff --git a/tests/generated/flex/margin_left.rs b/tests/generated/flex/margin_left.rs index 5146b3882..b537e7f99 100644 --- a/tests/generated/flex/margin_left.rs +++ b/tests/generated/flex/margin_left.rs @@ -6,6 +6,7 @@ fn margin_left__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), right: zero(), top: zero(), bottom: zero() }, ..Default::default() @@ -14,6 +15,10 @@ fn margin_left__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn margin_left__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: length(10f32), right: zero(), top: zero(), bottom: zero() }, ..Default::default() @@ -133,6 +139,10 @@ fn margin_left__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_right.rs b/tests/generated/flex/margin_right.rs index e4a2cd79c..cb3361daf 100644 --- a/tests/generated/flex/margin_right.rs +++ b/tests/generated/flex/margin_right.rs @@ -6,6 +6,7 @@ fn margin_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -14,6 +15,10 @@ fn margin_right__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn margin_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -134,6 +140,10 @@ fn margin_right__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 113bf3343..848e6fa54 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 @@ -6,6 +6,7 @@ fn margin_should_not_be_part_of_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -18,6 +19,10 @@ fn margin_should_not_be_part_of_max_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(250f32), height: taffy::style::Dimension::from_length(250f32), @@ -128,6 +133,7 @@ fn margin_should_not_be_part_of_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -141,6 +147,10 @@ fn margin_should_not_be_part_of_max_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(250f32), height: taffy::style::Dimension::from_length(250f32), 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 415a48f57..8717e189c 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 @@ -6,6 +6,7 @@ fn margin_should_not_be_part_of_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -18,6 +19,10 @@ fn margin_should_not_be_part_of_max_width__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(250f32), height: taffy::style::Dimension::from_length(250f32), @@ -128,6 +133,7 @@ fn margin_should_not_be_part_of_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -141,6 +147,10 @@ fn margin_should_not_be_part_of_max_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(250f32), height: taffy::style::Dimension::from_length(250f32), diff --git a/tests/generated/flex/margin_top.rs b/tests/generated/flex/margin_top.rs index 70e0344be..fc3fdf24e 100644 --- a/tests/generated/flex/margin_top.rs +++ b/tests/generated/flex/margin_top.rs @@ -6,6 +6,7 @@ fn margin_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -15,6 +16,10 @@ fn margin_top__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn margin_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() @@ -129,6 +135,10 @@ fn margin_top__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_with_sibling_column.rs b/tests/generated/flex/margin_with_sibling_column.rs index cdd598aec..d4e223ce2 100644 --- a/tests/generated/flex/margin_with_sibling_column.rs +++ b/tests/generated/flex/margin_with_sibling_column.rs @@ -6,16 +6,27 @@ fn margin_with_sibling_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -159,6 +170,7 @@ fn margin_with_sibling_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(10f32) }, ..Default::default() @@ -167,6 +179,7 @@ fn margin_with_sibling_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -176,6 +189,10 @@ fn margin_with_sibling_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/margin_with_sibling_row.rs b/tests/generated/flex/margin_with_sibling_row.rs index ac799cdb7..02c2229c7 100644 --- a/tests/generated/flex/margin_with_sibling_row.rs +++ b/tests/generated/flex/margin_with_sibling_row.rs @@ -6,15 +6,26 @@ fn margin_with_sibling_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -170,6 +181,7 @@ fn margin_with_sibling_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() @@ -178,6 +190,7 @@ fn margin_with_sibling_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -186,6 +199,10 @@ fn margin_with_sibling_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/max_height.rs b/tests/generated/flex/max_height.rs index 9f8747359..1274855e3 100644 --- a/tests/generated/flex/max_height.rs +++ b/tests/generated/flex/max_height.rs @@ -6,6 +6,7 @@ fn max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -14,6 +15,10 @@ fn max_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -118,6 +123,7 @@ fn max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -127,6 +133,10 @@ fn max_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/max_height_overrides_height.rs b/tests/generated/flex/max_height_overrides_height.rs index db5c037e6..8b45c1693 100644 --- a/tests/generated/flex/max_height_overrides_height.rs +++ b/tests/generated/flex/max_height_overrides_height.rs @@ -6,12 +6,24 @@ fn max_height_overrides_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -113,6 +125,7 @@ fn max_height_overrides_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -120,7 +133,14 @@ fn max_height_overrides_height__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 f34361c03..fe9704719 100644 --- a/tests/generated/flex/max_height_overrides_height_on_root.rs +++ b/tests/generated/flex/max_height_overrides_height_on_root.rs @@ -6,6 +6,7 @@ fn max_height_overrides_height_on_root__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -67,6 +68,7 @@ fn max_height_overrides_height_on_root__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() diff --git a/tests/generated/flex/max_width.rs b/tests/generated/flex/max_width.rs index 47367bfec..01ebec432 100644 --- a/tests/generated/flex/max_width.rs +++ b/tests/generated/flex/max_width.rs @@ -6,6 +6,7 @@ fn max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -15,6 +16,10 @@ fn max_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -129,6 +135,10 @@ fn max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/max_width_overrides_width.rs b/tests/generated/flex/max_width_overrides_width.rs index 47fb26b86..6a67b15d8 100644 --- a/tests/generated/flex/max_width_overrides_width.rs +++ b/tests/generated/flex/max_width_overrides_width.rs @@ -6,12 +6,24 @@ fn max_width_overrides_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -107,6 +119,7 @@ fn max_width_overrides_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -114,7 +127,14 @@ fn max_width_overrides_width__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 94d6af66a..5783f9a51 100644 --- a/tests/generated/flex/max_width_overrides_width_on_root.rs +++ b/tests/generated/flex/max_width_overrides_width_on_root.rs @@ -6,6 +6,7 @@ fn max_width_overrides_width_on_root__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -67,6 +68,7 @@ fn max_width_overrides_width_on_root__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/measure_child.rs b/tests/generated/flex/measure_child.rs index 531e9dfe3..c30a8fc4c 100644 --- a/tests/generated/flex/measure_child.rs +++ b/tests/generated/flex/measure_child.rs @@ -6,11 +6,28 @@ fn measure_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -105,13 +122,27 @@ fn measure_child__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/measure_child_absolute.rs b/tests/generated/flex/measure_child_absolute.rs index b422c12b7..80f7fc7e5 100644 --- a/tests/generated/flex/measure_child_absolute.rs +++ b/tests/generated/flex/measure_child_absolute.rs @@ -6,13 +6,24 @@ fn measure_child_absolute__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { position: taffy::style::Position::Absolute, ..Default::default() }, + taffy::style::Style { + position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +130,10 @@ fn measure_child_absolute__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), @@ -128,6 +143,10 @@ fn measure_child_absolute__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/measure_child_constraint.rs b/tests/generated/flex/measure_child_constraint.rs index 6abdacafc..856bd91a1 100644 --- a/tests/generated/flex/measure_child_constraint.rs +++ b/tests/generated/flex/measure_child_constraint.rs @@ -7,13 +7,23 @@ fn measure_child_constraint__border_box() { let node0_text = "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" ; let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::AUTO, @@ -124,7 +134,14 @@ fn measure_child_constraint__content_box() { let node0_text = "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" ; let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); @@ -132,6 +149,10 @@ fn measure_child_constraint__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::AUTO, diff --git a/tests/generated/flex/measure_child_constraint_padding_parent.rs b/tests/generated/flex/measure_child_constraint_padding_parent.rs index bee3f956f..3c3779b05 100644 --- a/tests/generated/flex/measure_child_constraint_padding_parent.rs +++ b/tests/generated/flex/measure_child_constraint_padding_parent.rs @@ -7,13 +7,23 @@ fn measure_child_constraint_padding_parent__border_box() { let node0_text = "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" ; let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::AUTO, @@ -130,7 +140,14 @@ fn measure_child_constraint_padding_parent__content_box() { let node0_text = "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" ; let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text(node0_text, crate::WritingMode::Horizontal), ) .unwrap(); @@ -138,6 +155,10 @@ fn measure_child_constraint_padding_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::AUTO, diff --git a/tests/generated/flex/measure_child_with_flex_grow.rs b/tests/generated/flex/measure_child_with_flex_grow.rs index c896bea5f..dbb9591bb 100644 --- a/tests/generated/flex/measure_child_with_flex_grow.rs +++ b/tests/generated/flex/measure_child_with_flex_grow.rs @@ -6,6 +6,7 @@ fn measure_child_with_flex_grow__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,13 +16,23 @@ fn measure_child_with_flex_grow__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("H\u{200b}H\u{200b}H\u{200b}H\u{200b}H", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, @@ -165,6 +176,7 @@ fn measure_child_with_flex_grow__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -174,7 +186,14 @@ fn measure_child_with_flex_grow__content_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("H\u{200b}H\u{200b}H\u{200b}H\u{200b}H", crate::WritingMode::Horizontal), ) .unwrap(); @@ -182,6 +201,10 @@ fn measure_child_with_flex_grow__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, diff --git a/tests/generated/flex/measure_child_with_flex_shrink.rs b/tests/generated/flex/measure_child_with_flex_shrink.rs index 80b6c9941..5f4de5f08 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink.rs @@ -6,6 +6,7 @@ fn measure_child_with_flex_shrink__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,7 +16,13 @@ fn measure_child_with_flex_shrink__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text( "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH", crate::WritingMode::Horizontal, @@ -25,6 +32,10 @@ fn measure_child_with_flex_shrink__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, @@ -168,6 +179,7 @@ fn measure_child_with_flex_shrink__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -177,7 +189,14 @@ fn measure_child_with_flex_shrink__content_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text( "HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH\u{200b}HHHHHHHHHH", crate::WritingMode::Horizontal, @@ -188,6 +207,10 @@ fn measure_child_with_flex_shrink__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, 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 4934f10a2..2996e2469 100644 --- a/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs +++ b/tests/generated/flex/measure_child_with_flex_shrink_hidden.rs @@ -6,6 +6,7 @@ fn measure_child_with_flex_shrink_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -32,6 +33,10 @@ fn measure_child_with_flex_shrink_hidden__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, @@ -175,6 +180,7 @@ fn measure_child_with_flex_shrink_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -203,6 +209,10 @@ fn measure_child_with_flex_shrink_hidden__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::AUTO, 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 33142c8d0..c34af3f60 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 @@ -7,6 +7,10 @@ fn measure_child_with_min_size_greater_than_available_space__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -18,6 +22,10 @@ fn measure_child_with_min_size_greater_than_available_space__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -120,6 +128,10 @@ fn measure_child_with_min_size_greater_than_available_space__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -132,6 +144,10 @@ fn measure_child_with_min_size_greater_than_available_space__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/measure_flex_basis_overrides_measure.rs b/tests/generated/flex/measure_flex_basis_overrides_measure.rs index 4da22439a..b658bf2be 100644 --- a/tests/generated/flex/measure_flex_basis_overrides_measure.rs +++ b/tests/generated/flex/measure_flex_basis_overrides_measure.rs @@ -6,13 +6,23 @@ fn measure_flex_basis_overrides_measure__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("H", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -116,7 +126,14 @@ fn measure_flex_basis_overrides_measure__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("H", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn measure_flex_basis_overrides_measure__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/measure_height_overrides_measure.rs b/tests/generated/flex/measure_height_overrides_measure.rs index 934b0aab8..eed6d7449 100644 --- a/tests/generated/flex/measure_height_overrides_measure.rs +++ b/tests/generated/flex/measure_height_overrides_measure.rs @@ -7,13 +7,28 @@ fn measure_height_overrides_measure__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(5f32) }, ..Default::default() }, crate::TestNodeContext::ahem_text("H", crate::WritingMode::Horizontal), ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -110,6 +125,10 @@ fn measure_height_overrides_measure__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(5f32) }, ..Default::default() }, @@ -118,7 +137,14 @@ fn measure_height_overrides_measure__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/measure_remeasure_child_after_growing.rs b/tests/generated/flex/measure_remeasure_child_after_growing.rs index c75a697ff..7d4c5be7b 100644 --- a/tests/generated/flex/measure_remeasure_child_after_growing.rs +++ b/tests/generated/flex/measure_remeasure_child_after_growing.rs @@ -6,6 +6,7 @@ fn measure_remeasure_child_after_growing__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,13 +16,23 @@ fn measure_remeasure_child_after_growing__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -166,6 +177,7 @@ fn measure_remeasure_child_after_growing__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -175,7 +187,14 @@ fn measure_remeasure_child_after_growing__content_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -183,6 +202,10 @@ fn measure_remeasure_child_after_growing__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs index 743788801..da5b03c97 100644 --- a/tests/generated/flex/measure_remeasure_child_after_shrinking.rs +++ b/tests/generated/flex/measure_remeasure_child_after_shrinking.rs @@ -6,6 +6,7 @@ fn measure_remeasure_child_after_shrinking__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -16,13 +17,23 @@ fn measure_remeasure_child_after_shrinking__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -167,6 +178,7 @@ fn measure_remeasure_child_after_shrinking__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -177,7 +189,14 @@ fn measure_remeasure_child_after_shrinking__content_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -185,6 +204,10 @@ fn measure_remeasure_child_after_shrinking__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/measure_remeasure_child_after_stretching.rs b/tests/generated/flex/measure_remeasure_child_after_stretching.rs index 134257b21..73fa15c75 100644 --- a/tests/generated/flex/measure_remeasure_child_after_stretching.rs +++ b/tests/generated/flex/measure_remeasure_child_after_stretching.rs @@ -6,13 +6,23 @@ fn measure_remeasure_child_after_stretching__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -122,7 +132,14 @@ fn measure_remeasure_child_after_stretching__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -130,6 +147,10 @@ fn measure_remeasure_child_after_stretching__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/measure_root.rs b/tests/generated/flex/measure_root.rs index 787ac8637..d466533e9 100644 --- a/tests/generated/flex/measure_root.rs +++ b/tests/generated/flex/measure_root.rs @@ -6,7 +6,13 @@ fn measure_root__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -65,7 +71,14 @@ fn measure_root__content_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); diff --git a/tests/generated/flex/measure_stretch_overrides_measure.rs b/tests/generated/flex/measure_stretch_overrides_measure.rs index 23ed57d6c..953c6c52b 100644 --- a/tests/generated/flex/measure_stretch_overrides_measure.rs +++ b/tests/generated/flex/measure_stretch_overrides_measure.rs @@ -6,6 +6,7 @@ fn measure_stretch_overrides_measure__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(5f32), ..Default::default() @@ -14,6 +15,10 @@ fn measure_stretch_overrides_measure__border_box() { let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(5f32), ..Default::default() @@ -24,6 +29,10 @@ fn measure_stretch_overrides_measure__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), @@ -167,6 +176,7 @@ fn measure_stretch_overrides_measure__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(5f32), ..Default::default() @@ -176,6 +186,10 @@ fn measure_stretch_overrides_measure__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(5f32), ..Default::default() @@ -187,6 +201,10 @@ fn measure_stretch_overrides_measure__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(10f32), diff --git a/tests/generated/flex/measure_width_overrides_measure.rs b/tests/generated/flex/measure_width_overrides_measure.rs index d97be8f45..9a3a80da2 100644 --- a/tests/generated/flex/measure_width_overrides_measure.rs +++ b/tests/generated/flex/measure_width_overrides_measure.rs @@ -7,13 +7,28 @@ fn measure_width_overrides_measure__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, crate::TestNodeContext::ahem_text("HHHHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -110,6 +125,10 @@ fn measure_width_overrides_measure__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -118,7 +137,14 @@ fn measure_width_overrides_measure__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/min_height.rs b/tests/generated/flex/min_height.rs index 83b87433c..78fd9007b 100644 --- a/tests/generated/flex/min_height.rs +++ b/tests/generated/flex/min_height.rs @@ -6,16 +6,27 @@ fn min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(60f32) }, ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -159,6 +170,7 @@ fn min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(60f32) }, ..Default::default() @@ -167,6 +179,7 @@ fn min_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -176,6 +189,10 @@ fn min_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/min_height_larger_than_height.rs b/tests/generated/flex/min_height_larger_than_height.rs index 2243f62b7..fc350626f 100644 --- a/tests/generated/flex/min_height_larger_than_height.rs +++ b/tests/generated/flex/min_height_larger_than_height.rs @@ -6,6 +6,7 @@ fn min_height_larger_than_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(25f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -14,6 +15,10 @@ fn min_height_larger_than_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -118,6 +123,7 @@ fn min_height_larger_than_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(25f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -127,6 +133,10 @@ fn min_height_larger_than_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/min_height_overrides_height.rs b/tests/generated/flex/min_height_overrides_height.rs index e1dcad6bc..4c9e6e19a 100644 --- a/tests/generated/flex/min_height_overrides_height.rs +++ b/tests/generated/flex/min_height_overrides_height.rs @@ -6,12 +6,24 @@ fn min_height_overrides_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -113,6 +125,7 @@ fn min_height_overrides_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -120,7 +133,14 @@ fn min_height_overrides_height__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 de20777f1..d8222b39c 100644 --- a/tests/generated/flex/min_height_overrides_height_on_root.rs +++ b/tests/generated/flex/min_height_overrides_height_on_root.rs @@ -6,6 +6,7 @@ fn min_height_overrides_height_on_root__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -67,6 +68,7 @@ fn min_height_overrides_height_on_root__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() diff --git a/tests/generated/flex/min_height_overrides_max_height.rs b/tests/generated/flex/min_height_overrides_max_height.rs index c76053201..7748c8c54 100644 --- a/tests/generated/flex/min_height_overrides_max_height.rs +++ b/tests/generated/flex/min_height_overrides_max_height.rs @@ -6,12 +6,24 @@ fn min_height_overrides_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -113,6 +125,7 @@ fn min_height_overrides_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() @@ -120,7 +133,14 @@ fn min_height_overrides_max_height__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 35294c777..96c89131a 100644 --- a/tests/generated/flex/min_height_with_nested_fixed_height.rs +++ b/tests/generated/flex/min_height_with_nested_fixed_height.rs @@ -6,6 +6,7 @@ fn min_height_with_nested_fixed_height__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -17,6 +18,10 @@ fn min_height_with_nested_fixed_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::FlexStart), flex_shrink: 0f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(28f32) }, @@ -29,6 +34,10 @@ fn min_height_with_nested_fixed_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(44f32) }, padding: taffy::geometry::Rect { @@ -182,6 +191,7 @@ fn min_height_with_nested_fixed_height__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -194,6 +204,10 @@ fn min_height_with_nested_fixed_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::FlexStart), flex_shrink: 0f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(28f32) }, @@ -207,6 +221,10 @@ fn min_height_with_nested_fixed_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(44f32) }, padding: taffy::geometry::Rect { 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 edbb321e8..dcffacfba 100644 --- a/tests/generated/flex/min_max_percent_different_width_height.rs +++ b/tests/generated/flex/min_max_percent_different_width_height.rs @@ -7,6 +7,10 @@ fn min_max_percent_different_width_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.1f32), height: taffy::style::Dimension::from_percent(0.1f32), @@ -24,6 +28,10 @@ fn min_max_percent_different_width_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -130,6 +138,10 @@ fn min_max_percent_different_width_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.1f32), height: taffy::style::Dimension::from_percent(0.1f32), @@ -148,6 +160,10 @@ fn min_max_percent_different_width_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 dc237deda..5fff04a8f 100644 --- a/tests/generated/flex/min_max_percent_no_width_height.rs +++ b/tests/generated/flex/min_max_percent_no_width_height.rs @@ -6,6 +6,7 @@ fn min_max_percent_no_width_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.1f32), height: taffy::style::Dimension::from_percent(0.1f32), @@ -21,6 +22,10 @@ fn min_max_percent_no_width_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -126,6 +131,7 @@ fn min_max_percent_no_width_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.1f32), height: taffy::style::Dimension::from_percent(0.1f32), @@ -142,6 +148,10 @@ fn min_max_percent_no_width_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/min_width.rs b/tests/generated/flex/min_width.rs index 64313675c..913c0f5ff 100644 --- a/tests/generated/flex/min_width.rs +++ b/tests/generated/flex/min_width.rs @@ -6,15 +6,26 @@ fn min_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -170,6 +181,7 @@ fn min_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -178,6 +190,7 @@ fn min_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -186,6 +199,10 @@ fn min_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/min_width_larger_than_width.rs b/tests/generated/flex/min_width_larger_than_width.rs index ae74676e6..97d78e1ee 100644 --- a/tests/generated/flex/min_width_larger_than_width.rs +++ b/tests/generated/flex/min_width_larger_than_width.rs @@ -6,6 +6,7 @@ fn min_width_larger_than_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -15,6 +16,10 @@ fn min_width_larger_than_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn min_width_larger_than_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -129,6 +135,10 @@ fn min_width_larger_than_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/min_width_overrides_max_width.rs b/tests/generated/flex/min_width_overrides_max_width.rs index 8705c5690..5bac0abc6 100644 --- a/tests/generated/flex/min_width_overrides_max_width.rs +++ b/tests/generated/flex/min_width_overrides_max_width.rs @@ -6,12 +6,24 @@ fn min_width_overrides_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -107,6 +119,7 @@ fn min_width_overrides_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -114,7 +127,14 @@ fn min_width_overrides_max_width__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/min_width_overrides_width.rs b/tests/generated/flex/min_width_overrides_width.rs index f396f622f..66d46eda6 100644 --- a/tests/generated/flex/min_width_overrides_width.rs +++ b/tests/generated/flex/min_width_overrides_width.rs @@ -6,12 +6,24 @@ fn min_width_overrides_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -107,6 +119,7 @@ fn min_width_overrides_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -114,7 +127,14 @@ fn min_width_overrides_width__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 5cfa3a911..4eaed54b1 100644 --- a/tests/generated/flex/min_width_overrides_width_on_root.rs +++ b/tests/generated/flex/min_width_overrides_width_on_root.rs @@ -6,6 +6,7 @@ fn min_width_overrides_width_on_root__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -67,6 +68,7 @@ fn min_width_overrides_width_on_root__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/multiline_column_max_height.rs b/tests/generated/flex/multiline_column_max_height.rs index 1e623a9cd..69a897ba0 100644 --- a/tests/generated/flex/multiline_column_max_height.rs +++ b/tests/generated/flex/multiline_column_max_height.rs @@ -6,6 +6,7 @@ fn multiline_column_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -16,6 +17,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -26,6 +28,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -36,6 +39,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -46,6 +50,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -56,6 +61,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -66,6 +72,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -76,6 +83,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -86,6 +94,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node8 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -96,6 +105,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node9 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -106,6 +116,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -116,6 +127,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -126,6 +138,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -136,6 +149,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node13 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -146,6 +160,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node14 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -156,6 +171,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node15 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -166,6 +182,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node16 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -176,6 +193,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node17 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -186,6 +204,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node18 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -196,6 +215,7 @@ fn multiline_column_max_height__border_box() { .unwrap(); let node19 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -210,6 +230,10 @@ fn multiline_column_max_height__border_box() { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() }, @@ -1115,6 +1139,7 @@ fn multiline_column_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1126,6 +1151,7 @@ fn multiline_column_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1137,6 +1163,7 @@ fn multiline_column_max_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1148,6 +1175,7 @@ fn multiline_column_max_height__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1159,6 +1187,7 @@ fn multiline_column_max_height__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1170,6 +1199,7 @@ fn multiline_column_max_height__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1181,6 +1211,7 @@ fn multiline_column_max_height__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1192,6 +1223,7 @@ fn multiline_column_max_height__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1203,6 +1235,7 @@ fn multiline_column_max_height__content_box() { let node8 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1214,6 +1247,7 @@ fn multiline_column_max_height__content_box() { let node9 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1225,6 +1259,7 @@ fn multiline_column_max_height__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1236,6 +1271,7 @@ fn multiline_column_max_height__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1247,6 +1283,7 @@ fn multiline_column_max_height__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1258,6 +1295,7 @@ fn multiline_column_max_height__content_box() { let node13 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1269,6 +1307,7 @@ fn multiline_column_max_height__content_box() { let node14 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1280,6 +1319,7 @@ fn multiline_column_max_height__content_box() { let node15 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1291,6 +1331,7 @@ fn multiline_column_max_height__content_box() { let node16 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1302,6 +1343,7 @@ fn multiline_column_max_height__content_box() { let node17 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1313,6 +1355,7 @@ fn multiline_column_max_height__content_box() { let node18 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1324,6 +1367,7 @@ fn multiline_column_max_height__content_box() { let node19 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), @@ -1339,6 +1383,10 @@ fn multiline_column_max_height__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() }, diff --git a/tests/generated/flex/multiline_min_max_12.rs b/tests/generated/flex/multiline_min_max_12.rs index cb68743da..e1f29cb3b 100644 --- a/tests/generated/flex/multiline_min_max_12.rs +++ b/tests/generated/flex/multiline_min_max_12.rs @@ -6,6 +6,7 @@ fn multiline_min_max_12__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -17,6 +18,7 @@ fn multiline_min_max_12__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -29,6 +31,7 @@ fn multiline_min_max_12__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -41,6 +44,7 @@ fn multiline_min_max_12__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -57,6 +61,10 @@ fn multiline_min_max_12__border_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), @@ -283,6 +291,7 @@ fn multiline_min_max_12__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -294,6 +303,7 @@ fn multiline_min_max_12__content_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -306,6 +316,7 @@ fn multiline_min_max_12__content_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -318,6 +329,7 @@ fn multiline_min_max_12__content_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -334,6 +346,10 @@ fn multiline_min_max_12__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), diff --git a/tests/generated/flex/multiline_min_max_13.rs b/tests/generated/flex/multiline_min_max_13.rs index 1eb01e850..43a416146 100644 --- a/tests/generated/flex/multiline_min_max_13.rs +++ b/tests/generated/flex/multiline_min_max_13.rs @@ -6,6 +6,7 @@ fn multiline_min_max_13__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -17,6 +18,7 @@ fn multiline_min_max_13__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -29,6 +31,7 @@ fn multiline_min_max_13__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -41,6 +44,7 @@ fn multiline_min_max_13__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -57,6 +61,10 @@ fn multiline_min_max_13__border_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), @@ -283,6 +291,7 @@ fn multiline_min_max_13__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -294,6 +303,7 @@ fn multiline_min_max_13__content_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -306,6 +316,7 @@ fn multiline_min_max_13__content_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -318,6 +329,7 @@ fn multiline_min_max_13__content_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -334,6 +346,10 @@ fn multiline_min_max_13__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), diff --git a/tests/generated/flex/multiline_min_max_14.rs b/tests/generated/flex/multiline_min_max_14.rs index 51ec785d0..205ab2349 100644 --- a/tests/generated/flex/multiline_min_max_14.rs +++ b/tests/generated/flex/multiline_min_max_14.rs @@ -6,6 +6,7 @@ fn multiline_min_max_14__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -17,6 +18,7 @@ fn multiline_min_max_14__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -29,6 +31,7 @@ fn multiline_min_max_14__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -41,6 +44,7 @@ fn multiline_min_max_14__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -57,6 +61,10 @@ fn multiline_min_max_14__border_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), @@ -283,6 +291,7 @@ fn multiline_min_max_14__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -294,6 +303,7 @@ fn multiline_min_max_14__content_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -306,6 +316,7 @@ fn multiline_min_max_14__content_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -318,6 +329,7 @@ fn multiline_min_max_14__content_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -334,6 +346,10 @@ fn multiline_min_max_14__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), diff --git a/tests/generated/flex/multiline_min_max_5.rs b/tests/generated/flex/multiline_min_max_5.rs index b4f980e2c..e8609e3e4 100644 --- a/tests/generated/flex/multiline_min_max_5.rs +++ b/tests/generated/flex/multiline_min_max_5.rs @@ -7,6 +7,7 @@ fn multiline_min_max_5__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -18,6 +19,7 @@ fn multiline_min_max_5__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -31,6 +33,7 @@ fn multiline_min_max_5__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -44,6 +47,7 @@ fn multiline_min_max_5__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -60,6 +64,10 @@ fn multiline_min_max_5__border_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), @@ -287,6 +295,7 @@ fn multiline_min_max_5__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -298,6 +307,7 @@ fn multiline_min_max_5__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -311,6 +321,7 @@ fn multiline_min_max_5__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -324,6 +335,7 @@ fn multiline_min_max_5__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -340,6 +352,10 @@ fn multiline_min_max_5__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), diff --git a/tests/generated/flex/multiline_min_max_8.rs b/tests/generated/flex/multiline_min_max_8.rs index d64a776f1..61293b2a2 100644 --- a/tests/generated/flex/multiline_min_max_8.rs +++ b/tests/generated/flex/multiline_min_max_8.rs @@ -6,6 +6,7 @@ fn multiline_min_max_8__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -17,6 +18,7 @@ fn multiline_min_max_8__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -29,6 +31,7 @@ fn multiline_min_max_8__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -41,6 +44,7 @@ fn multiline_min_max_8__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -57,6 +61,10 @@ fn multiline_min_max_8__border_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), @@ -284,6 +292,7 @@ fn multiline_min_max_8__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(600f32), @@ -296,6 +305,7 @@ fn multiline_min_max_8__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -309,6 +319,7 @@ fn multiline_min_max_8__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -322,6 +333,7 @@ fn multiline_min_max_8__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::AUTO, @@ -338,6 +350,10 @@ fn multiline_min_max_8__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(600f32), height: taffy::style::Dimension::from_length(20f32), diff --git a/tests/generated/flex/nested_overflowing_child.rs b/tests/generated/flex/nested_overflowing_child.rs index 99265e7e0..511c1a481 100644 --- a/tests/generated/flex/nested_overflowing_child.rs +++ b/tests/generated/flex/nested_overflowing_child.rs @@ -6,6 +6,7 @@ fn nested_overflowing_child__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -13,10 +14,25 @@ fn nested_overflowing_child__border_box() { ..Default::default() }) .unwrap(); - let node0 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node00]).unwrap(); + let node0 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node00], + ) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -172,6 +188,7 @@ fn nested_overflowing_child__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -181,7 +198,14 @@ fn nested_overflowing_child__content_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -189,6 +213,10 @@ fn nested_overflowing_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 4540ddff6..8a71b5a63 100644 --- a/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs +++ b/tests/generated/flex/nested_overflowing_child_in_constraint_parent.rs @@ -6,6 +6,7 @@ fn nested_overflowing_child_in_constraint_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -16,6 +17,10 @@ fn nested_overflowing_child_in_constraint_parent__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -28,6 +33,10 @@ fn nested_overflowing_child_in_constraint_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -183,6 +192,7 @@ fn nested_overflowing_child_in_constraint_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -194,6 +204,10 @@ fn nested_overflowing_child_in_constraint_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -207,6 +221,10 @@ fn nested_overflowing_child_in_constraint_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 694602fad..e267e0aa5 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 @@ -6,6 +6,7 @@ fn only_shrinkable_item_with_flex_basis_zero__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -13,6 +14,7 @@ fn only_shrinkable_item_with_flex_basis_zero__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(93f32), margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(6f32) }, @@ -21,6 +23,7 @@ fn only_shrinkable_item_with_flex_basis_zero__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(764f32), ..Default::default() @@ -30,6 +33,10 @@ fn only_shrinkable_item_with_flex_basis_zero__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(480f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(764f32) }, ..Default::default() @@ -216,6 +223,7 @@ fn only_shrinkable_item_with_flex_basis_zero__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), ..Default::default() @@ -224,6 +232,7 @@ fn only_shrinkable_item_with_flex_basis_zero__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(93f32), margin: taffy::geometry::Rect { left: zero(), right: zero(), top: zero(), bottom: length(6f32) }, @@ -233,6 +242,7 @@ fn only_shrinkable_item_with_flex_basis_zero__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(764f32), ..Default::default() @@ -243,6 +253,10 @@ fn only_shrinkable_item_with_flex_basis_zero__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(480f32), height: auto() }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(764f32) }, ..Default::default() diff --git a/tests/generated/flex/overflow_cross_axis.rs b/tests/generated/flex/overflow_cross_axis.rs index ea0d15559..c0979f3ad 100644 --- a/tests/generated/flex/overflow_cross_axis.rs +++ b/tests/generated/flex/overflow_cross_axis.rs @@ -6,6 +6,7 @@ fn overflow_cross_axis__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -16,6 +17,10 @@ fn overflow_cross_axis__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -126,6 +131,7 @@ fn overflow_cross_axis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -137,6 +143,10 @@ fn overflow_cross_axis__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/overflow_main_axis.rs b/tests/generated/flex/overflow_main_axis.rs index 7817c98f3..7b835c495 100644 --- a/tests/generated/flex/overflow_main_axis.rs +++ b/tests/generated/flex/overflow_main_axis.rs @@ -6,6 +6,7 @@ fn overflow_main_axis__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() @@ -14,6 +15,10 @@ fn overflow_main_axis__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn overflow_main_axis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() @@ -133,6 +139,10 @@ fn overflow_main_axis__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs index fde71a862..06dbbd614 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_hidden.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_hidden.rs @@ -21,6 +21,10 @@ fn overflow_main_axis_shrink_hidden__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -141,6 +145,10 @@ fn overflow_main_axis_shrink_hidden__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs index 4ee69d2e3..363d7d65d 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_scroll.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_scroll.rs @@ -21,6 +21,10 @@ fn overflow_main_axis_shrink_scroll__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -141,6 +145,10 @@ fn overflow_main_axis_shrink_scroll__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/overflow_main_axis_shrink_visible.rs b/tests/generated/flex/overflow_main_axis_shrink_visible.rs index 8e4bf3df7..fdaaa216c 100644 --- a/tests/generated/flex/overflow_main_axis_shrink_visible.rs +++ b/tests/generated/flex/overflow_main_axis_shrink_visible.rs @@ -6,13 +6,24 @@ fn overflow_main_axis_shrink_visible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { flex_shrink: 1f32, ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_shrink: 1f32, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -118,6 +129,10 @@ fn overflow_main_axis_shrink_visible__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_shrink: 1f32, ..Default::default() }, @@ -128,6 +143,10 @@ fn overflow_main_axis_shrink_visible__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), 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 74bafaa91..58ac1d3a9 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 @@ -6,6 +6,7 @@ fn overflow_scroll_main_axis_justify_content_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() @@ -14,6 +15,10 @@ fn overflow_scroll_main_axis_justify_content_end__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -125,6 +130,7 @@ fn overflow_scroll_main_axis_justify_content_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() @@ -134,6 +140,10 @@ fn overflow_scroll_main_axis_justify_content_end__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs index 3d0942d6a..8534ed6bb 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_available_space.rs @@ -4,7 +4,13 @@ fn overflow_scrollbars_overridden_by_available_space__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { @@ -22,6 +28,10 @@ fn overflow_scrollbars_overridden_by_available_space__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), @@ -165,6 +175,7 @@ fn overflow_scrollbars_overridden_by_available_space__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -188,6 +199,10 @@ fn overflow_scrollbars_overridden_by_available_space__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs index 58fa2fffb..957fa4a60 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_max_size.rs @@ -4,7 +4,13 @@ fn overflow_scrollbars_overridden_by_max_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -117,6 +123,7 @@ fn overflow_scrollbars_overridden_by_max_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) diff --git a/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs b/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs index 67c88b423..4b9a4b9db 100644 --- a/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/flex/overflow_scrollbars_overridden_by_size.rs @@ -4,7 +4,13 @@ fn overflow_scrollbars_overridden_by_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -117,6 +123,7 @@ fn overflow_scrollbars_overridden_by_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) 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 55d5e5387..4d785a56d 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 @@ -4,7 +4,13 @@ fn overflow_scrollbars_take_up_space_both_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -117,6 +123,7 @@ fn overflow_scrollbars_take_up_space_both_axis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) 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 96729dea2..9b102f593 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 @@ -4,7 +4,13 @@ fn overflow_scrollbars_take_up_space_cross_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -117,6 +123,7 @@ fn overflow_scrollbars_take_up_space_cross_axis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) 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 81aaf299d..b883e974f 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 @@ -4,7 +4,13 @@ fn overflow_scrollbars_take_up_space_main_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -117,6 +123,7 @@ fn overflow_scrollbars_take_up_space_main_axis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) diff --git a/tests/generated/flex/padding_align_end_child.rs b/tests/generated/flex/padding_align_end_child.rs index 689db2471..46fb5ad3d 100644 --- a/tests/generated/flex/padding_align_end_child.rs +++ b/tests/generated/flex/padding_align_end_child.rs @@ -6,6 +6,7 @@ fn padding_align_end_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -22,6 +23,10 @@ fn padding_align_end_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { @@ -134,6 +139,7 @@ fn padding_align_end_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -151,6 +157,10 @@ fn padding_align_end_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), justify_content: Some(taffy::style::JustifyContent::FlexEnd), size: taffy::geometry::Size { diff --git a/tests/generated/flex/padding_border_overrides_max_size.rs b/tests/generated/flex/padding_border_overrides_max_size.rs index 74e52c6c3..888221706 100644 --- a/tests/generated/flex/padding_border_overrides_max_size.rs +++ b/tests/generated/flex/padding_border_overrides_max_size.rs @@ -6,6 +6,7 @@ fn padding_border_overrides_max_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -25,7 +26,18 @@ fn padding_border_overrides_max_size__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -121,6 +133,7 @@ fn padding_border_overrides_max_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -142,7 +155,14 @@ fn padding_border_overrides_max_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/padding_border_overrides_min_size.rs b/tests/generated/flex/padding_border_overrides_min_size.rs index e7892e101..651fb7e8d 100644 --- a/tests/generated/flex/padding_border_overrides_min_size.rs +++ b/tests/generated/flex/padding_border_overrides_min_size.rs @@ -6,6 +6,7 @@ fn padding_border_overrides_min_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -25,7 +26,18 @@ fn padding_border_overrides_min_size__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -121,6 +133,7 @@ fn padding_border_overrides_min_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -142,7 +155,14 @@ fn padding_border_overrides_min_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/padding_border_overrides_size.rs b/tests/generated/flex/padding_border_overrides_size.rs index fce483721..935afa973 100644 --- a/tests/generated/flex/padding_border_overrides_size.rs +++ b/tests/generated/flex/padding_border_overrides_size.rs @@ -6,6 +6,7 @@ fn padding_border_overrides_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -25,7 +26,18 @@ fn padding_border_overrides_size__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -121,6 +133,7 @@ fn padding_border_overrides_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -142,7 +155,14 @@ fn padding_border_overrides_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 b1ed694f0..4220c70ac 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 @@ -6,6 +6,7 @@ fn padding_border_overrides_size_flex_basis_0_growable__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { @@ -29,6 +30,7 @@ fn padding_border_overrides_size_flex_basis_0_growable__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { @@ -38,7 +40,18 @@ fn padding_border_overrides_size_flex_basis_0_growable__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -173,6 +186,7 @@ fn padding_border_overrides_size_flex_basis_0_growable__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { @@ -197,6 +211,7 @@ fn padding_border_overrides_size_flex_basis_0_growable__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0f32), size: taffy::geometry::Size { @@ -208,7 +223,14 @@ fn padding_border_overrides_size_flex_basis_0_growable__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); diff --git a/tests/generated/flex/padding_border_overrides_size_root.rs b/tests/generated/flex/padding_border_overrides_size_root.rs index 0c09e65c3..65ac09859 100644 --- a/tests/generated/flex/padding_border_overrides_size_root.rs +++ b/tests/generated/flex/padding_border_overrides_size_root.rs @@ -4,10 +4,19 @@ fn padding_border_overrides_size_root__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -122,12 +131,20 @@ fn padding_border_overrides_size_root__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), diff --git a/tests/generated/flex/padding_center_child.rs b/tests/generated/flex/padding_center_child.rs index 0b11e0960..2b1d06b6f 100644 --- a/tests/generated/flex/padding_center_child.rs +++ b/tests/generated/flex/padding_center_child.rs @@ -6,6 +6,7 @@ fn padding_center_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn padding_center_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -128,6 +133,7 @@ fn padding_center_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -139,6 +145,10 @@ fn padding_center_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/flex/padding_container_match_child.rs b/tests/generated/flex/padding_container_match_child.rs index 703fa731c..9f2cfe03f 100644 --- a/tests/generated/flex/padding_container_match_child.rs +++ b/tests/generated/flex/padding_container_match_child.rs @@ -6,6 +6,7 @@ fn padding_container_match_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn padding_container_match_child__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -123,6 +128,7 @@ fn padding_container_match_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -135,6 +141,10 @@ fn padding_container_match_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/padding_flex_child.rs b/tests/generated/flex/padding_flex_child.rs index b9171d92f..5fdadd3a8 100644 --- a/tests/generated/flex/padding_flex_child.rs +++ b/tests/generated/flex/padding_flex_child.rs @@ -6,6 +6,7 @@ fn padding_flex_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -14,6 +15,10 @@ fn padding_flex_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn padding_flex_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -133,6 +139,10 @@ fn padding_flex_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/padding_no_child.rs b/tests/generated/flex/padding_no_child.rs index c1a6dde04..71094fedf 100644 --- a/tests/generated/flex/padding_no_child.rs +++ b/tests/generated/flex/padding_no_child.rs @@ -6,6 +6,7 @@ fn padding_no_child__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -71,6 +72,7 @@ fn padding_no_child__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/padding_no_size.rs b/tests/generated/flex/padding_no_size.rs index a4d1cb589..549665a7f 100644 --- a/tests/generated/flex/padding_no_size.rs +++ b/tests/generated/flex/padding_no_size.rs @@ -6,6 +6,7 @@ fn padding_no_size__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -71,6 +72,7 @@ fn padding_no_size__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/padding_stretch_child.rs b/tests/generated/flex/padding_stretch_child.rs index d871bd99e..24fe30fc6 100644 --- a/tests/generated/flex/padding_stretch_child.rs +++ b/tests/generated/flex/padding_stretch_child.rs @@ -6,6 +6,7 @@ fn padding_stretch_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -13,6 +14,10 @@ fn padding_stretch_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +128,7 @@ fn padding_stretch_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -131,6 +137,10 @@ fn padding_stretch_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 29414dad0..7cd727181 100644 --- a/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs +++ b/tests/generated/flex/parent_wrap_child_size_overflowing_parent.rs @@ -6,6 +6,7 @@ fn parent_wrap_child_size_overflowing_parent__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -16,6 +17,10 @@ fn parent_wrap_child_size_overflowing_parent__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -25,6 +30,10 @@ fn parent_wrap_child_size_overflowing_parent__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -180,6 +189,7 @@ fn parent_wrap_child_size_overflowing_parent__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(200f32), @@ -191,6 +201,10 @@ fn parent_wrap_child_size_overflowing_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -201,6 +215,10 @@ fn parent_wrap_child_size_overflowing_parent__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/percent_absolute_position.rs b/tests/generated/flex/percent_absolute_position.rs index 1a99ce461..64359ebe3 100644 --- a/tests/generated/flex/percent_absolute_position.rs +++ b/tests/generated/flex/percent_absolute_position.rs @@ -6,12 +6,14 @@ fn percent_absolute_position__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) @@ -20,6 +22,10 @@ fn percent_absolute_position__border_box() { .new_with_children( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -34,6 +40,10 @@ fn percent_absolute_position__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(50f32), @@ -228,6 +238,7 @@ fn percent_absolute_position__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) @@ -235,6 +246,7 @@ fn percent_absolute_position__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) @@ -244,6 +256,10 @@ fn percent_absolute_position__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(50f32), @@ -259,6 +275,10 @@ fn percent_absolute_position__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/flex/percent_within_flex_grow.rs b/tests/generated/flex/percent_within_flex_grow.rs index 7276d4a1c..9f901124f 100644 --- a/tests/generated/flex/percent_within_flex_grow.rs +++ b/tests/generated/flex/percent_within_flex_grow.rs @@ -6,12 +6,14 @@ fn percent_within_flex_grow__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) @@ -20,6 +22,10 @@ fn percent_within_flex_grow__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -28,6 +34,7 @@ fn percent_within_flex_grow__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) @@ -35,6 +42,10 @@ fn percent_within_flex_grow__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(350f32), height: taffy::style::Dimension::from_length(100f32), @@ -274,6 +285,7 @@ fn percent_within_flex_grow__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) @@ -281,6 +293,7 @@ fn percent_within_flex_grow__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() }) @@ -290,6 +303,10 @@ fn percent_within_flex_grow__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, ..Default::default() }, @@ -299,6 +316,7 @@ fn percent_within_flex_grow__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) @@ -307,6 +325,10 @@ fn percent_within_flex_grow__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(350f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/percentage_absolute_position.rs b/tests/generated/flex/percentage_absolute_position.rs index f4a45ba41..d670318d9 100644 --- a/tests/generated/flex/percentage_absolute_position.rs +++ b/tests/generated/flex/percentage_absolute_position.rs @@ -7,6 +7,7 @@ fn percentage_absolute_position__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -19,6 +20,10 @@ fn percentage_absolute_position__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,6 +129,7 @@ fn percentage_absolute_position__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -137,6 +143,10 @@ fn percentage_absolute_position__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/percentage_container_in_wrapping_container.rs b/tests/generated/flex/percentage_container_in_wrapping_container.rs index e8fee0496..55e7053ee 100644 --- a/tests/generated/flex/percentage_container_in_wrapping_container.rs +++ b/tests/generated/flex/percentage_container_in_wrapping_container.rs @@ -6,6 +6,7 @@ fn percentage_container_in_wrapping_container__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -15,6 +16,7 @@ fn percentage_container_in_wrapping_container__border_box() { .unwrap(); let node001 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -25,6 +27,10 @@ fn percentage_container_in_wrapping_container__border_box() { let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -34,7 +40,14 @@ fn percentage_container_in_wrapping_container__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -42,6 +55,10 @@ fn percentage_container_in_wrapping_container__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { @@ -283,6 +300,7 @@ fn percentage_container_in_wrapping_container__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -293,6 +311,7 @@ fn percentage_container_in_wrapping_container__content_box() { let node001 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -304,6 +323,10 @@ fn percentage_container_in_wrapping_container__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -316,6 +339,10 @@ fn percentage_container_in_wrapping_container__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -326,6 +353,10 @@ fn percentage_container_in_wrapping_container__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { diff --git a/tests/generated/flex/percentage_different_width_height.rs b/tests/generated/flex/percentage_different_width_height.rs index c7a85839d..247874868 100644 --- a/tests/generated/flex/percentage_different_width_height.rs +++ b/tests/generated/flex/percentage_different_width_height.rs @@ -6,6 +6,7 @@ fn percentage_different_width_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn percentage_different_width_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() }) @@ -20,6 +22,10 @@ fn percentage_different_width_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(300f32), @@ -163,6 +169,7 @@ fn percentage_different_width_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() @@ -171,6 +178,7 @@ fn percentage_different_width_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() }) @@ -179,6 +187,10 @@ fn percentage_different_width_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(300f32), diff --git a/tests/generated/flex/percentage_different_width_height_column.rs b/tests/generated/flex/percentage_different_width_height_column.rs index 47ef57db8..7b850f877 100644 --- a/tests/generated/flex/percentage_different_width_height_column.rs +++ b/tests/generated/flex/percentage_different_width_height_column.rs @@ -4,9 +4,16 @@ fn percentage_different_width_height_column__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() }) @@ -15,6 +22,10 @@ fn percentage_different_width_height_column__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(300f32), @@ -164,6 +175,7 @@ fn percentage_different_width_height_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -171,6 +183,7 @@ fn percentage_different_width_height_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.3f32) }, ..Default::default() }) @@ -180,6 +193,10 @@ fn percentage_different_width_height_column__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(300f32), diff --git a/tests/generated/flex/percentage_flex_basis.rs b/tests/generated/flex/percentage_flex_basis.rs index 0cd5b1f60..2e4c75bc1 100644 --- a/tests/generated/flex/percentage_flex_basis.rs +++ b/tests/generated/flex/percentage_flex_basis.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), ..Default::default() @@ -13,6 +14,7 @@ fn percentage_flex_basis__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.25f32), ..Default::default() @@ -21,6 +23,10 @@ fn percentage_flex_basis__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -176,6 +182,7 @@ fn percentage_flex_basis__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), ..Default::default() @@ -184,6 +191,7 @@ fn percentage_flex_basis__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.25f32), ..Default::default() @@ -193,6 +201,10 @@ fn percentage_flex_basis__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/percentage_flex_basis_cross.rs b/tests/generated/flex/percentage_flex_basis_cross.rs index 89ab7c7da..d1c275226 100644 --- a/tests/generated/flex/percentage_flex_basis_cross.rs +++ b/tests/generated/flex/percentage_flex_basis_cross.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_cross__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), ..Default::default() @@ -13,6 +14,7 @@ fn percentage_flex_basis_cross__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.25f32), ..Default::default() @@ -22,6 +24,10 @@ fn percentage_flex_basis_cross__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -177,6 +183,7 @@ fn percentage_flex_basis_cross__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.5f32), ..Default::default() @@ -185,6 +192,7 @@ fn percentage_flex_basis_cross__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.25f32), ..Default::default() @@ -195,6 +203,10 @@ fn percentage_flex_basis_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 aae8b608a..46c2476f9 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_height.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_cross_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_cross_max_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, @@ -24,6 +26,10 @@ fn percentage_flex_basis_cross_max_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -173,6 +179,7 @@ fn percentage_flex_basis_cross_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, @@ -182,6 +189,7 @@ fn percentage_flex_basis_cross_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, @@ -193,6 +201,10 @@ fn percentage_flex_basis_cross_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 efa597132..8171b858a 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_max_width.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_cross_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_cross_max_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -24,6 +26,10 @@ fn percentage_flex_basis_cross_max_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -179,6 +185,7 @@ fn percentage_flex_basis_cross_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -188,6 +195,7 @@ fn percentage_flex_basis_cross_max_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -199,6 +207,10 @@ fn percentage_flex_basis_cross_max_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 b6d02d167..9e5b9a231 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_height.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_height.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_cross_min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn percentage_flex_basis_cross_min_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 2f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, ..Default::default() @@ -22,6 +24,10 @@ fn percentage_flex_basis_cross_min_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -177,6 +183,7 @@ fn percentage_flex_basis_cross_min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, ..Default::default() @@ -185,6 +192,7 @@ fn percentage_flex_basis_cross_min_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 2f32, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, ..Default::default() @@ -195,6 +203,10 @@ fn percentage_flex_basis_cross_min_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 8a8e5d2f6..7ba599a8e 100644 --- a/tests/generated/flex/percentage_flex_basis_cross_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_cross_min_width.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_cross_min_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_cross_min_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -24,6 +26,10 @@ fn percentage_flex_basis_cross_min_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -179,6 +185,7 @@ fn percentage_flex_basis_cross_min_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -188,6 +195,7 @@ fn percentage_flex_basis_cross_min_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -199,6 +207,10 @@ fn percentage_flex_basis_cross_min_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 7a587de13..e5a523de0 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_height.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_height.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_main_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_main_max_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, @@ -23,6 +25,10 @@ fn percentage_flex_basis_main_max_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -172,6 +178,7 @@ fn percentage_flex_basis_main_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.6f32) }, @@ -181,6 +188,7 @@ fn percentage_flex_basis_main_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.2f32) }, @@ -191,6 +199,10 @@ fn percentage_flex_basis_main_max_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 1f42cdcd2..4f48ba8c8 100644 --- a/tests/generated/flex/percentage_flex_basis_main_max_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_max_width.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_main_max_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_main_max_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -23,6 +25,10 @@ fn percentage_flex_basis_main_max_width__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -178,6 +184,7 @@ fn percentage_flex_basis_main_max_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -187,6 +194,7 @@ fn percentage_flex_basis_main_max_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -197,6 +205,10 @@ fn percentage_flex_basis_main_max_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 d0488ed3e..8603aeb62 100644 --- a/tests/generated/flex/percentage_flex_basis_main_min_width.rs +++ b/tests/generated/flex/percentage_flex_basis_main_min_width.rs @@ -6,6 +6,7 @@ fn percentage_flex_basis_main_min_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -14,6 +15,7 @@ fn percentage_flex_basis_main_min_width__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -23,6 +25,10 @@ fn percentage_flex_basis_main_min_width__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -178,6 +184,7 @@ fn percentage_flex_basis_main_min_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto() }, @@ -187,6 +194,7 @@ fn percentage_flex_basis_main_min_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -197,6 +205,10 @@ fn percentage_flex_basis_main_min_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), diff --git a/tests/generated/flex/percentage_main_max_height.rs b/tests/generated/flex/percentage_main_max_height.rs index efa3732b5..7ba60638d 100644 --- a/tests/generated/flex/percentage_main_max_height.rs +++ b/tests/generated/flex/percentage_main_max_height.rs @@ -5,10 +5,15 @@ fn percentage_main_max_height__border_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(15f32), ..Default::default() }) + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_basis: taffy::style::Dimension::from_length(15f32), + ..Default::default() + }) .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(48f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.33f32) }, ..Default::default() @@ -18,6 +23,10 @@ fn percentage_main_max_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(151f32) }, ..Default::default() @@ -29,6 +38,10 @@ fn percentage_main_max_height__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(71f32), height: auto() }, ..Default::default() }, @@ -226,6 +239,7 @@ fn percentage_main_max_height__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(15f32), ..Default::default() }) @@ -233,6 +247,7 @@ fn percentage_main_max_height__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(48f32), max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.33f32) }, ..Default::default() @@ -243,6 +258,10 @@ fn percentage_main_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(151f32) }, ..Default::default() @@ -255,6 +274,10 @@ fn percentage_main_max_height__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(71f32), height: auto() }, ..Default::default() }, 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 55192d523..e802688e8 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 @@ -6,6 +6,7 @@ fn percentage_margin_should_calculate_based_only_on_width__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn percentage_margin_should_calculate_based_only_on_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: percent(0.1f32), @@ -33,6 +38,10 @@ fn percentage_margin_should_calculate_based_only_on_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -182,6 +191,7 @@ fn percentage_margin_should_calculate_based_only_on_width__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -194,6 +204,10 @@ fn percentage_margin_should_calculate_based_only_on_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, margin: taffy::geometry::Rect { left: percent(0.1f32), @@ -211,6 +225,10 @@ fn percentage_margin_should_calculate_based_only_on_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/percentage_moderate_complexity.rs b/tests/generated/flex/percentage_moderate_complexity.rs index e178a5577..e1fb69823 100644 --- a/tests/generated/flex/percentage_moderate_complexity.rs +++ b/tests/generated/flex/percentage_moderate_complexity.rs @@ -7,6 +7,7 @@ fn percentage_moderate_complexity__border_box() { taffy.disable_rounding(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -28,6 +29,10 @@ fn percentage_moderate_complexity__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -51,6 +56,10 @@ fn percentage_moderate_complexity__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), @@ -228,6 +237,7 @@ fn percentage_moderate_complexity__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -250,6 +260,10 @@ fn percentage_moderate_complexity__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -274,6 +288,10 @@ fn percentage_moderate_complexity__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), diff --git a/tests/generated/flex/percentage_moderate_complexity2.rs b/tests/generated/flex/percentage_moderate_complexity2.rs index 951a486ff..bde6a608d 100644 --- a/tests/generated/flex/percentage_moderate_complexity2.rs +++ b/tests/generated/flex/percentage_moderate_complexity2.rs @@ -6,6 +6,7 @@ fn percentage_moderate_complexity2__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn percentage_moderate_complexity2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, padding: taffy::geometry::Rect { left: percent(0.1f32), @@ -33,6 +38,10 @@ fn percentage_moderate_complexity2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -182,6 +191,7 @@ fn percentage_moderate_complexity2__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -194,6 +204,10 @@ fn percentage_moderate_complexity2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, padding: taffy::geometry::Rect { left: percent(0.1f32), @@ -211,6 +225,10 @@ fn percentage_moderate_complexity2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 ee89b52e5..04f29f6dc 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 @@ -6,6 +6,7 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -26,6 +27,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -48,6 +53,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { @@ -73,6 +82,7 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -83,6 +93,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__border_ .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -322,6 +336,7 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -343,6 +358,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -366,6 +385,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_percent(0.1f32), min_size: taffy::geometry::Size { @@ -392,6 +415,7 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_percent(0.15f32), min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.2f32), height: auto() }, @@ -403,6 +427,10 @@ fn percentage_multiple_nested_with_padding_margin_and_percentage_values__content taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), 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 c370ef31a..3534d5edf 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 @@ -6,6 +6,7 @@ fn percentage_padding_should_calculate_based_only_on_width__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -17,6 +18,10 @@ fn percentage_padding_should_calculate_based_only_on_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, padding: taffy::geometry::Rect { left: percent(0.1f32), @@ -33,6 +38,10 @@ fn percentage_padding_should_calculate_based_only_on_width__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), @@ -188,6 +197,7 @@ fn percentage_padding_should_calculate_based_only_on_width__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -200,6 +210,10 @@ fn percentage_padding_should_calculate_based_only_on_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, padding: taffy::geometry::Rect { left: percent(0.1f32), @@ -217,6 +231,10 @@ fn percentage_padding_should_calculate_based_only_on_width__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/percentage_position_bottom_right.rs b/tests/generated/flex/percentage_position_bottom_right.rs index 7cd9b2b54..ed6ba3aee 100644 --- a/tests/generated/flex/percentage_position_bottom_right.rs +++ b/tests/generated/flex/percentage_position_bottom_right.rs @@ -6,6 +6,7 @@ fn percentage_position_bottom_right__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.55f32), height: taffy::style::Dimension::from_percent(0.15f32), @@ -17,6 +18,10 @@ fn percentage_position_bottom_right__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -121,6 +126,7 @@ fn percentage_position_bottom_right__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.55f32), height: taffy::style::Dimension::from_percent(0.15f32), @@ -133,6 +139,10 @@ fn percentage_position_bottom_right__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), diff --git a/tests/generated/flex/percentage_position_left_top.rs b/tests/generated/flex/percentage_position_left_top.rs index 4305dbe1f..e6bae1eff 100644 --- a/tests/generated/flex/percentage_position_left_top.rs +++ b/tests/generated/flex/percentage_position_left_top.rs @@ -6,6 +6,7 @@ fn percentage_position_left_top__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: taffy::style::Dimension::from_percent(0.55f32), @@ -17,6 +18,10 @@ fn percentage_position_left_top__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(400f32), @@ -127,6 +132,7 @@ fn percentage_position_left_top__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: taffy::style::Dimension::from_percent(0.55f32), @@ -139,6 +145,10 @@ fn percentage_position_left_top__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(400f32), 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 f32c2df85..a61b2ffd1 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 @@ -6,6 +6,7 @@ fn percentage_size_based_on_parent_inner_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -17,6 +18,10 @@ fn percentage_size_based_on_parent_inner_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -133,6 +138,7 @@ fn percentage_size_based_on_parent_inner_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -145,6 +151,10 @@ fn percentage_size_based_on_parent_inner_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), diff --git a/tests/generated/flex/percentage_size_of_flex_basis.rs b/tests/generated/flex/percentage_size_of_flex_basis.rs index 52d43f3a9..5fa840e37 100644 --- a/tests/generated/flex/percentage_size_of_flex_basis.rs +++ b/tests/generated/flex/percentage_size_of_flex_basis.rs @@ -6,6 +6,7 @@ fn percentage_size_of_flex_basis__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(100f32), @@ -15,13 +16,24 @@ fn percentage_size_of_flex_basis__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + flex_basis: taffy::style::Dimension::from_length(50f32), + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -174,6 +186,7 @@ fn percentage_size_of_flex_basis__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_length(100f32), @@ -185,6 +198,10 @@ fn percentage_size_of_flex_basis__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(50f32), ..Default::default() }, @@ -195,6 +212,10 @@ fn percentage_size_of_flex_basis__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 259ca18ff..ec16173a7 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 @@ -4,10 +4,19 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1.2f32), height: auto() }, ..Default::default() }, @@ -17,6 +26,10 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -170,12 +183,20 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1.2f32), height: auto() }, ..Default::default() }, @@ -186,6 +207,10 @@ fn percentage_sizes_should_not_prevent_flex_shrinking__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/percentage_width_height.rs b/tests/generated/flex/percentage_width_height.rs index 9081289cc..da560f911 100644 --- a/tests/generated/flex/percentage_width_height.rs +++ b/tests/generated/flex/percentage_width_height.rs @@ -6,6 +6,7 @@ fn percentage_width_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.3f32), height: taffy::style::Dimension::from_percent(0.3f32), @@ -16,6 +17,10 @@ fn percentage_width_height__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), @@ -126,6 +131,7 @@ fn percentage_width_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.3f32), height: taffy::style::Dimension::from_percent(0.3f32), @@ -137,6 +143,10 @@ fn percentage_width_height__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(400f32), 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 46d8261a3..d6e24fea9 100644 --- a/tests/generated/flex/percentage_width_height_undefined_parent_size.rs +++ b/tests/generated/flex/percentage_width_height_undefined_parent_size.rs @@ -6,6 +6,7 @@ fn percentage_width_height_undefined_parent_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -15,7 +16,14 @@ fn percentage_width_height_undefined_parent_size__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -114,6 +122,7 @@ fn percentage_width_height_undefined_parent_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: taffy::style::Dimension::from_percent(0.5f32), @@ -126,6 +135,10 @@ fn percentage_width_height_undefined_parent_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 8e992058b..5ad509e70 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 @@ -6,6 +6,7 @@ fn position_root_with_rtl_should_position_withoutdirection__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -14,7 +15,18 @@ fn position_root_with_rtl_should_position_withoutdirection__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -110,6 +122,7 @@ fn position_root_with_rtl_should_position_withoutdirection__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(52f32), height: taffy::style::Dimension::from_length(52f32), @@ -120,7 +133,14 @@ fn position_root_with_rtl_should_position_withoutdirection__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 8bd00a099..238db5a98 100644 --- a/tests/generated/flex/relative_position_should_not_nudge_siblings.rs +++ b/tests/generated/flex/relative_position_should_not_nudge_siblings.rs @@ -6,6 +6,7 @@ fn relative_position_should_not_nudge_siblings__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(15f32), bottom: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn relative_position_should_not_nudge_siblings__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(15f32), bottom: auto() }, ..Default::default() @@ -22,6 +24,10 @@ fn relative_position_should_not_nudge_siblings__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -165,6 +171,7 @@ fn relative_position_should_not_nudge_siblings__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(15f32), bottom: auto() }, ..Default::default() @@ -173,6 +180,7 @@ fn relative_position_should_not_nudge_siblings__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(15f32), bottom: auto() }, ..Default::default() @@ -183,6 +191,10 @@ fn relative_position_should_not_nudge_siblings__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 6ac6e8f60..001d4d715 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 @@ -4,14 +4,48 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(113f32), height: taffy::style::Dimension::from_length(100f32), @@ -302,6 +336,7 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -309,6 +344,7 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -316,6 +352,7 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -323,6 +360,7 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -330,6 +368,7 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -338,6 +377,10 @@ fn rounding_flex_basis_flex_grow_row_prime_number_width__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(113f32), height: taffy::style::Dimension::from_length(100f32), 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 c7d4e65ec..6ea06d67e 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 @@ -4,12 +4,34 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -210,6 +232,7 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -217,6 +240,7 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -224,6 +248,7 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -232,6 +257,10 @@ fn rounding_flex_basis_flex_grow_row_width_of_100__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 5f1ae17c3..af1e97779 100644 --- a/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs +++ b/tests/generated/flex/rounding_flex_basis_flex_shrink_row.rs @@ -6,20 +6,33 @@ fn rounding_flex_basis_flex_shrink_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(25f32), ..Default::default() }) + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_basis: taffy::style::Dimension::from_length(25f32), + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { flex_basis: taffy::style::Dimension::from_length(25f32), ..Default::default() }) + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_basis: taffy::style::Dimension::from_length(25f32), + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(101f32), height: taffy::style::Dimension::from_length(100f32), @@ -220,6 +233,7 @@ fn rounding_flex_basis_flex_shrink_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_length(100f32), ..Default::default() @@ -228,6 +242,7 @@ fn rounding_flex_basis_flex_shrink_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(25f32), ..Default::default() }) @@ -235,6 +250,7 @@ fn rounding_flex_basis_flex_shrink_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_basis: taffy::style::Dimension::from_length(25f32), ..Default::default() }) @@ -243,6 +259,10 @@ fn rounding_flex_basis_flex_shrink_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(101f32), height: taffy::style::Dimension::from_length(100f32), 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 79a2d10e1..4c527f375 100644 --- a/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs +++ b/tests/generated/flex/rounding_flex_basis_overrides_main_size.rs @@ -6,6 +6,7 @@ fn rounding_flex_basis_overrides_main_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -14,6 +15,7 @@ fn rounding_flex_basis_overrides_main_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_flex_basis_overrides_main_size__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_flex_basis_overrides_main_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113f32), @@ -212,6 +219,7 @@ fn rounding_flex_basis_overrides_main_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -221,6 +229,7 @@ fn rounding_flex_basis_overrides_main_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_flex_basis_overrides_main_size__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_flex_basis_overrides_main_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113f32), diff --git a/tests/generated/flex/rounding_fractial_input_1.rs b/tests/generated/flex/rounding_fractial_input_1.rs index 8d9df8bd5..aa2723698 100644 --- a/tests/generated/flex/rounding_fractial_input_1.rs +++ b/tests/generated/flex/rounding_fractial_input_1.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_1__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -14,6 +15,7 @@ fn rounding_fractial_input_1__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_fractial_input_1__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_fractial_input_1__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), @@ -212,6 +219,7 @@ fn rounding_fractial_input_1__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -221,6 +229,7 @@ fn rounding_fractial_input_1__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_fractial_input_1__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_fractial_input_1__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), diff --git a/tests/generated/flex/rounding_fractial_input_2.rs b/tests/generated/flex/rounding_fractial_input_2.rs index df801bafd..f52fc846b 100644 --- a/tests/generated/flex/rounding_fractial_input_2.rs +++ b/tests/generated/flex/rounding_fractial_input_2.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_2__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -14,6 +15,7 @@ fn rounding_fractial_input_2__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_fractial_input_2__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_fractial_input_2__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.6f32), @@ -212,6 +219,7 @@ fn rounding_fractial_input_2__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -221,6 +229,7 @@ fn rounding_fractial_input_2__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_fractial_input_2__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_fractial_input_2__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.6f32), diff --git a/tests/generated/flex/rounding_fractial_input_3.rs b/tests/generated/flex/rounding_fractial_input_3.rs index 7a597d922..ca0b57105 100644 --- a/tests/generated/flex/rounding_fractial_input_3.rs +++ b/tests/generated/flex/rounding_fractial_input_3.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_3__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -14,6 +15,7 @@ fn rounding_fractial_input_3__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_fractial_input_3__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_fractial_input_3__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), @@ -212,6 +219,7 @@ fn rounding_fractial_input_3__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -221,6 +229,7 @@ fn rounding_fractial_input_3__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_fractial_input_3__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_fractial_input_3__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), diff --git a/tests/generated/flex/rounding_fractial_input_4.rs b/tests/generated/flex/rounding_fractial_input_4.rs index e2cb0847a..09c1f0cc7 100644 --- a/tests/generated/flex/rounding_fractial_input_4.rs +++ b/tests/generated/flex/rounding_fractial_input_4.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_4__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -14,6 +15,7 @@ fn rounding_fractial_input_4__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_fractial_input_4__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_fractial_input_4__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), @@ -212,6 +219,7 @@ fn rounding_fractial_input_4__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(50f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, @@ -221,6 +229,7 @@ fn rounding_fractial_input_4__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_fractial_input_4__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_fractial_input_4__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(113.4f32), diff --git a/tests/generated/flex/rounding_fractial_input_5.rs b/tests/generated/flex/rounding_fractial_input_5.rs index dd4edaabd..cce21fba4 100644 --- a/tests/generated/flex/rounding_fractial_input_5.rs +++ b/tests/generated/flex/rounding_fractial_input_5.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_5__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100.3f32), height: taffy::style::Dimension::from_length(100.3f32), @@ -15,6 +16,7 @@ fn rounding_fractial_input_5__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100.3f32), height: taffy::style::Dimension::from_length(100.3f32), @@ -25,6 +27,10 @@ fn rounding_fractial_input_5__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(963.333f32), @@ -181,6 +187,7 @@ fn rounding_fractial_input_5__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100.3f32), height: taffy::style::Dimension::from_length(100.3f32), @@ -191,6 +198,7 @@ fn rounding_fractial_input_5__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100.3f32), height: taffy::style::Dimension::from_length(100.3f32), @@ -202,6 +210,10 @@ fn rounding_fractial_input_5__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(963.333f32), diff --git a/tests/generated/flex/rounding_fractial_input_6.rs b/tests/generated/flex/rounding_fractial_input_6.rs index 096aa9dfd..a247471cf 100644 --- a/tests/generated/flex/rounding_fractial_input_6.rs +++ b/tests/generated/flex/rounding_fractial_input_6.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_6__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn rounding_fractial_input_6__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn rounding_fractial_input_6__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -34,6 +40,7 @@ fn rounding_fractial_input_6__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -43,6 +50,7 @@ fn rounding_fractial_input_6__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -54,6 +62,10 @@ fn rounding_fractial_input_6__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -63,6 +75,10 @@ fn rounding_fractial_input_6__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(7f32), height: auto() }, ..Default::default() }, @@ -383,6 +399,7 @@ fn rounding_fractial_input_6__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -393,6 +410,7 @@ fn rounding_fractial_input_6__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -405,6 +423,10 @@ fn rounding_fractial_input_6__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -414,6 +436,7 @@ fn rounding_fractial_input_6__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -424,6 +447,7 @@ fn rounding_fractial_input_6__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(10f32), @@ -436,6 +460,10 @@ fn rounding_fractial_input_6__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -446,6 +474,10 @@ fn rounding_fractial_input_6__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(7f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/rounding_fractial_input_7.rs b/tests/generated/flex/rounding_fractial_input_7.rs index 31351ad18..bfa05f561 100644 --- a/tests/generated/flex/rounding_fractial_input_7.rs +++ b/tests/generated/flex/rounding_fractial_input_7.rs @@ -6,6 +6,7 @@ fn rounding_fractial_input_7__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -26,6 +28,10 @@ fn rounding_fractial_input_7__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -34,6 +40,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -43,6 +50,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node11 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -54,6 +62,10 @@ fn rounding_fractial_input_7__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -62,6 +74,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -71,6 +84,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node21 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -82,6 +96,10 @@ fn rounding_fractial_input_7__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -90,6 +108,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node30 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -99,6 +118,7 @@ fn rounding_fractial_input_7__border_box() { .unwrap(); let node31 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -110,6 +130,10 @@ fn rounding_fractial_input_7__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -119,6 +143,10 @@ fn rounding_fractial_input_7__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(7f32), height: auto() }, ..Default::default() }, @@ -697,6 +725,7 @@ fn rounding_fractial_input_7__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -707,6 +736,7 @@ fn rounding_fractial_input_7__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -719,6 +749,10 @@ fn rounding_fractial_input_7__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -728,6 +762,7 @@ fn rounding_fractial_input_7__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -738,6 +773,7 @@ fn rounding_fractial_input_7__content_box() { let node11 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -750,6 +786,10 @@ fn rounding_fractial_input_7__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -759,6 +799,7 @@ fn rounding_fractial_input_7__content_box() { let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -769,6 +810,7 @@ fn rounding_fractial_input_7__content_box() { let node21 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -781,6 +823,10 @@ fn rounding_fractial_input_7__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -790,6 +836,7 @@ fn rounding_fractial_input_7__content_box() { let node30 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -800,6 +847,7 @@ fn rounding_fractial_input_7__content_box() { let node31 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(1f32), height: taffy::style::Dimension::from_length(10f32), @@ -812,6 +860,10 @@ fn rounding_fractial_input_7__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.25f32), height: auto() }, ..Default::default() }, @@ -822,6 +874,10 @@ fn rounding_fractial_input_7__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(7f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/rounding_inner_node_controversy_combined.rs b/tests/generated/flex/rounding_inner_node_controversy_combined.rs index 9b6ba23f9..0ca2c0322 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_combined.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_combined.rs @@ -6,6 +6,7 @@ fn rounding_inner_node_controversy_combined__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn rounding_inner_node_controversy_combined__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -20,6 +22,7 @@ fn rounding_inner_node_controversy_combined__border_box() { .unwrap(); let node110 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -29,6 +32,10 @@ fn rounding_inner_node_controversy_combined__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -38,6 +45,7 @@ fn rounding_inner_node_controversy_combined__border_box() { .unwrap(); let node12 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -47,6 +55,10 @@ fn rounding_inner_node_controversy_combined__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -56,6 +68,7 @@ fn rounding_inner_node_controversy_combined__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -64,6 +77,10 @@ fn rounding_inner_node_controversy_combined__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(640f32), height: taffy::style::Dimension::from_length(320f32), @@ -450,6 +467,7 @@ fn rounding_inner_node_controversy_combined__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -458,6 +476,7 @@ fn rounding_inner_node_controversy_combined__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -466,6 +485,7 @@ fn rounding_inner_node_controversy_combined__content_box() { let node110 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -476,6 +496,10 @@ fn rounding_inner_node_controversy_combined__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -486,6 +510,7 @@ fn rounding_inner_node_controversy_combined__content_box() { let node12 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: auto() }, ..Default::default() @@ -496,6 +521,10 @@ fn rounding_inner_node_controversy_combined__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -506,6 +535,7 @@ fn rounding_inner_node_controversy_combined__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() @@ -515,6 +545,10 @@ fn rounding_inner_node_controversy_combined__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(640f32), height: taffy::style::Dimension::from_length(320f32), diff --git a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs index ebe74c7ed..2eaca5583 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_horizontal.rs @@ -6,6 +6,7 @@ fn rounding_inner_node_controversy_horizontal__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -13,6 +14,7 @@ fn rounding_inner_node_controversy_horizontal__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -22,6 +24,10 @@ fn rounding_inner_node_controversy_horizontal__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -31,6 +37,7 @@ fn rounding_inner_node_controversy_horizontal__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -39,6 +46,10 @@ fn rounding_inner_node_controversy_horizontal__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, ..Default::default() }, @@ -263,6 +274,7 @@ fn rounding_inner_node_controversy_horizontal__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -271,6 +283,7 @@ fn rounding_inner_node_controversy_horizontal__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -281,6 +294,10 @@ fn rounding_inner_node_controversy_horizontal__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -291,6 +308,7 @@ fn rounding_inner_node_controversy_horizontal__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -300,6 +318,10 @@ fn rounding_inner_node_controversy_horizontal__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs index 0be4b50eb..9b87b99c5 100644 --- a/tests/generated/flex/rounding_inner_node_controversy_vertical.rs +++ b/tests/generated/flex/rounding_inner_node_controversy_vertical.rs @@ -6,6 +6,7 @@ fn rounding_inner_node_controversy_vertical__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -13,6 +14,7 @@ fn rounding_inner_node_controversy_vertical__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -22,6 +24,10 @@ fn rounding_inner_node_controversy_vertical__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -31,6 +37,7 @@ fn rounding_inner_node_controversy_vertical__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -40,6 +47,10 @@ fn rounding_inner_node_controversy_vertical__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(320f32) }, ..Default::default() }, @@ -282,6 +293,7 @@ fn rounding_inner_node_controversy_vertical__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -290,6 +302,7 @@ fn rounding_inner_node_controversy_vertical__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -300,6 +313,10 @@ fn rounding_inner_node_controversy_vertical__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -310,6 +327,7 @@ fn rounding_inner_node_controversy_vertical__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() @@ -320,6 +338,10 @@ fn rounding_inner_node_controversy_vertical__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(320f32) }, ..Default::default() }, diff --git a/tests/generated/flex/rounding_total_fractial.rs b/tests/generated/flex/rounding_total_fractial.rs index 24a4854e0..9143d0e36 100644 --- a/tests/generated/flex/rounding_total_fractial.rs +++ b/tests/generated/flex/rounding_total_fractial.rs @@ -6,6 +6,7 @@ fn rounding_total_fractial__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.7f32, flex_basis: taffy::style::Dimension::from_length(50.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20.3f32) }, @@ -14,6 +15,7 @@ fn rounding_total_fractial__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.6f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -21,6 +23,7 @@ fn rounding_total_fractial__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10.7f32) }, ..Default::default() @@ -30,6 +33,10 @@ fn rounding_total_fractial__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(87.4f32), height: taffy::style::Dimension::from_length(113.4f32), @@ -212,6 +219,7 @@ fn rounding_total_fractial__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 0.7f32, flex_basis: taffy::style::Dimension::from_length(50.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20.3f32) }, @@ -221,6 +229,7 @@ fn rounding_total_fractial__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.6f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -229,6 +238,7 @@ fn rounding_total_fractial__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10.7f32) }, ..Default::default() @@ -239,6 +249,10 @@ fn rounding_total_fractial__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(87.4f32), height: taffy::style::Dimension::from_length(113.4f32), diff --git a/tests/generated/flex/rounding_total_fractial_nested.rs b/tests/generated/flex/rounding_total_fractial_nested.rs index 5b2daf88f..63d89bd3f 100644 --- a/tests/generated/flex/rounding_total_fractial_nested.rs +++ b/tests/generated/flex/rounding_total_fractial_nested.rs @@ -6,6 +6,7 @@ fn rounding_total_fractial_nested__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(9.9f32) }, @@ -15,6 +16,7 @@ fn rounding_total_fractial_nested__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_length(0.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1.1f32) }, @@ -26,6 +28,10 @@ fn rounding_total_fractial_nested__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0.7f32, flex_basis: taffy::style::Dimension::from_length(50.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20.3f32) }, @@ -36,6 +42,7 @@ fn rounding_total_fractial_nested__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.6f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -43,6 +50,7 @@ fn rounding_total_fractial_nested__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10.7f32) }, ..Default::default() @@ -52,6 +60,10 @@ fn rounding_total_fractial_nested__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(87.4f32), height: taffy::style::Dimension::from_length(113.4f32), @@ -324,6 +336,7 @@ fn rounding_total_fractial_nested__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_basis: taffy::style::Dimension::from_length(0.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(9.9f32) }, @@ -334,6 +347,7 @@ fn rounding_total_fractial_nested__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 4f32, flex_basis: taffy::style::Dimension::from_length(0.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(1.1f32) }, @@ -346,6 +360,10 @@ fn rounding_total_fractial_nested__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 0.7f32, flex_basis: taffy::style::Dimension::from_length(50.3f32), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20.3f32) }, @@ -357,6 +375,7 @@ fn rounding_total_fractial_nested__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.6f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() @@ -365,6 +384,7 @@ fn rounding_total_fractial_nested__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1.1f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10.7f32) }, ..Default::default() @@ -375,6 +395,10 @@ fn rounding_total_fractial_nested__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(87.4f32), height: taffy::style::Dimension::from_length(113.4f32), diff --git a/tests/generated/flex/scroll_size.rs b/tests/generated/flex/scroll_size.rs index a14fe508c..39f31c685 100644 --- a/tests/generated/flex/scroll_size.rs +++ b/tests/generated/flex/scroll_size.rs @@ -6,6 +6,7 @@ fn scroll_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -134,6 +135,7 @@ fn scroll_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/simple_child.rs b/tests/generated/flex/simple_child.rs index 578edf049..a41423f0f 100644 --- a/tests/generated/flex/simple_child.rs +++ b/tests/generated/flex/simple_child.rs @@ -6,6 +6,7 @@ fn simple_child__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn simple_child__border_box() { let node00 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -27,6 +32,7 @@ fn simple_child__border_box() { .unwrap(); let node010 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -37,6 +43,7 @@ fn simple_child__border_box() { .unwrap(); let node011 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -45,10 +52,25 @@ fn simple_child__border_box() { ..Default::default() }) .unwrap(); - let node01 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node010, node011]).unwrap(); + let node01 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node010, node011], + ) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -61,6 +83,10 @@ fn simple_child__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -396,6 +422,7 @@ fn simple_child__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -407,6 +434,10 @@ fn simple_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -419,6 +450,7 @@ fn simple_child__content_box() { let node010 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -430,6 +462,7 @@ fn simple_child__content_box() { let node011 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -440,7 +473,14 @@ fn simple_child__content_box() { .unwrap(); let node01 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node010, node011], ) .unwrap(); @@ -448,6 +488,10 @@ fn simple_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -461,6 +505,10 @@ fn simple_child__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 871abd69d..403abb2a4 100644 --- a/tests/generated/flex/single_flex_child_after_absolute_child.rs +++ b/tests/generated/flex/single_flex_child_after_absolute_child.rs @@ -7,6 +7,7 @@ fn single_flex_child_after_absolute_child__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -14,10 +15,17 @@ fn single_flex_child_after_absolute_child__border_box() { ..Default::default() }) .unwrap(); - let node1 = - taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + flex_shrink: 1f32, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(174f32), ..Default::default() @@ -27,6 +35,10 @@ fn single_flex_child_after_absolute_child__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(428f32), height: taffy::style::Dimension::from_length(845f32), @@ -228,6 +240,7 @@ fn single_flex_child_after_absolute_child__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -238,6 +251,7 @@ fn single_flex_child_after_absolute_child__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, ..Default::default() @@ -246,6 +260,7 @@ fn single_flex_child_after_absolute_child__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, flex_basis: taffy::style::Dimension::from_length(174f32), ..Default::default() @@ -256,6 +271,10 @@ fn single_flex_child_after_absolute_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(428f32), height: taffy::style::Dimension::from_length(845f32), diff --git a/tests/generated/flex/size_defined_by_child.rs b/tests/generated/flex/size_defined_by_child.rs index 4428250fe..97cfa562a 100644 --- a/tests/generated/flex/size_defined_by_child.rs +++ b/tests/generated/flex/size_defined_by_child.rs @@ -6,6 +6,7 @@ fn size_defined_by_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -13,7 +14,18 @@ fn size_defined_by_child__border_box() { ..Default::default() }) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -115,6 +127,7 @@ fn size_defined_by_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -124,7 +137,14 @@ fn size_defined_by_child__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 694657cb0..481b5fb3c 100644 --- a/tests/generated/flex/size_defined_by_child_with_border.rs +++ b/tests/generated/flex/size_defined_by_child_with_border.rs @@ -6,6 +6,7 @@ fn size_defined_by_child_with_border__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn size_defined_by_child_with_border__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -122,6 +127,7 @@ fn size_defined_by_child_with_border__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -133,6 +139,10 @@ fn size_defined_by_child_with_border__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(10f32), right: length(10f32), 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 207802582..661a4fa5b 100644 --- a/tests/generated/flex/size_defined_by_child_with_padding.rs +++ b/tests/generated/flex/size_defined_by_child_with_padding.rs @@ -6,6 +6,7 @@ fn size_defined_by_child_with_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -16,6 +17,10 @@ fn size_defined_by_child_with_padding__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), @@ -122,6 +127,7 @@ fn size_defined_by_child_with_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -133,6 +139,10 @@ fn size_defined_by_child_with_padding__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(10f32), right: length(10f32), diff --git a/tests/generated/flex/size_defined_by_grand_child.rs b/tests/generated/flex/size_defined_by_grand_child.rs index a97c0c543..49b32bdf7 100644 --- a/tests/generated/flex/size_defined_by_grand_child.rs +++ b/tests/generated/flex/size_defined_by_grand_child.rs @@ -6,6 +6,7 @@ fn size_defined_by_grand_child__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -13,8 +14,30 @@ fn size_defined_by_grand_child__border_box() { ..Default::default() }) .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(); + let node0 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node00], + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -161,6 +184,7 @@ fn size_defined_by_grand_child__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -170,13 +194,27 @@ fn size_defined_by_grand_child__content_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/flex/taffy_issue_696.rs b/tests/generated/flex/taffy_issue_696.rs index c51f16d65..bc5b706fd 100644 --- a/tests/generated/flex/taffy_issue_696.rs +++ b/tests/generated/flex/taffy_issue_696.rs @@ -7,6 +7,7 @@ fn taffy_issue_696__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -40,6 +41,10 @@ fn taffy_issue_696__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -193,6 +198,7 @@ fn taffy_issue_696__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -228,6 +234,10 @@ fn taffy_issue_696__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/taffy_issue_696_flex_basis_20.rs b/tests/generated/flex/taffy_issue_696_flex_basis_20.rs index 9abca91fb..aaf570e04 100644 --- a/tests/generated/flex/taffy_issue_696_flex_basis_20.rs +++ b/tests/generated/flex/taffy_issue_696_flex_basis_20.rs @@ -7,6 +7,7 @@ fn taffy_issue_696_flex_basis_20__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -40,6 +41,10 @@ fn taffy_issue_696_flex_basis_20__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -193,6 +198,7 @@ fn taffy_issue_696_flex_basis_20__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -228,6 +234,10 @@ fn taffy_issue_696_flex_basis_20__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/taffy_issue_696_min_height.rs b/tests/generated/flex/taffy_issue_696_min_height.rs index f49fb30ec..2266c2dc3 100644 --- a/tests/generated/flex/taffy_issue_696_min_height.rs +++ b/tests/generated/flex/taffy_issue_696_min_height.rs @@ -7,6 +7,7 @@ fn taffy_issue_696_min_height__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -17,6 +18,10 @@ fn taffy_issue_696_min_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(0f32), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, padding: taffy::geometry::Rect { @@ -35,6 +40,10 @@ fn taffy_issue_696_min_height__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -188,6 +197,7 @@ fn taffy_issue_696_min_height__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -199,6 +209,10 @@ fn taffy_issue_696_min_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_basis: taffy::style::Dimension::from_length(0f32), min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, padding: taffy::geometry::Rect { @@ -218,6 +232,10 @@ fn taffy_issue_696_min_height__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/taffy_issue_696_no_flex_basis.rs b/tests/generated/flex/taffy_issue_696_no_flex_basis.rs index f81fa8dee..9ffdf76c2 100644 --- a/tests/generated/flex/taffy_issue_696_no_flex_basis.rs +++ b/tests/generated/flex/taffy_issue_696_no_flex_basis.rs @@ -7,6 +7,7 @@ fn taffy_issue_696_no_flex_basis__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -39,6 +40,10 @@ fn taffy_issue_696_no_flex_basis__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -192,6 +197,7 @@ fn taffy_issue_696_no_flex_basis__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -226,6 +232,10 @@ fn taffy_issue_696_no_flex_basis__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/taffy_issue_696_overflow_hidden.rs b/tests/generated/flex/taffy_issue_696_overflow_hidden.rs index e79e6845e..616fa37fa 100644 --- a/tests/generated/flex/taffy_issue_696_overflow_hidden.rs +++ b/tests/generated/flex/taffy_issue_696_overflow_hidden.rs @@ -7,6 +7,7 @@ fn taffy_issue_696_overflow_hidden__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -39,6 +40,10 @@ fn taffy_issue_696_overflow_hidden__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -186,6 +191,7 @@ fn taffy_issue_696_overflow_hidden__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_shrink: 0f32, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(200f32) }, ..Default::default() @@ -220,6 +226,10 @@ fn taffy_issue_696_overflow_hidden__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/undefined_height_with_min_max.rs b/tests/generated/flex/undefined_height_with_min_max.rs index 223180e21..ddb40528d 100644 --- a/tests/generated/flex/undefined_height_with_min_max.rs +++ b/tests/generated/flex/undefined_height_with_min_max.rs @@ -6,6 +6,7 @@ fn undefined_height_with_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -15,6 +16,10 @@ fn undefined_height_with_min_max__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, ..Default::default() @@ -117,6 +122,7 @@ fn undefined_height_with_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(100f32) }, ..Default::default() @@ -127,6 +133,10 @@ fn undefined_height_with_min_max__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(320f32), height: auto() }, min_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(0f32) }, ..Default::default() diff --git a/tests/generated/flex/undefined_width_with_min_max.rs b/tests/generated/flex/undefined_width_with_min_max.rs index 19717d518..afb1ca668 100644 --- a/tests/generated/flex/undefined_width_with_min_max.rs +++ b/tests/generated/flex/undefined_width_with_min_max.rs @@ -6,6 +6,7 @@ fn undefined_width_with_min_max__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -15,6 +16,10 @@ fn undefined_width_with_min_max__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, @@ -116,6 +121,7 @@ fn undefined_width_with_min_max__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -126,6 +132,10 @@ fn undefined_width_with_min_max__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, 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 0aa98fb6f..ed29db9ea 100644 --- a/tests/generated/flex/undefined_width_with_min_max_row.rs +++ b/tests/generated/flex/undefined_width_with_min_max_row.rs @@ -6,6 +6,7 @@ fn undefined_width_with_min_max_row__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,10 @@ fn undefined_width_with_min_max_row__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -26,6 +31,10 @@ fn undefined_width_with_min_max_row__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, @@ -172,6 +181,7 @@ fn undefined_width_with_min_max_row__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -183,6 +193,10 @@ fn undefined_width_with_min_max_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -194,6 +208,10 @@ fn undefined_width_with_min_max_row__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, ..Default::default() }, 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 02d3c3ef8..b52689375 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 @@ -6,6 +6,7 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -26,6 +31,7 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -47,6 +57,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -311,6 +330,7 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -334,6 +358,10 @@ fn width_smaller_then_content_with_flex_grow_large_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 a84491a96..55d367611 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 @@ -6,6 +6,7 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -26,6 +31,7 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -47,6 +57,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -311,6 +330,7 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -334,6 +358,10 @@ fn width_smaller_then_content_with_flex_grow_small_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }, 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 279cee152..06c5462e6 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 @@ -6,6 +6,7 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -26,6 +31,7 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -44,7 +54,18 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__border_box() { &[node10], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -281,6 +302,7 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -293,6 +315,10 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -303,6 +329,7 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -315,6 +342,10 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -324,7 +355,14 @@ fn width_smaller_then_content_with_flex_grow_unconstraint_size__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); 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 273a17d27..75e837aa3 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 @@ -6,6 +6,7 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -17,6 +18,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -26,6 +31,7 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -37,6 +43,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -47,6 +57,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -289,6 +303,7 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: taffy::style::Dimension::from_length(100f32), @@ -301,6 +316,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -311,6 +330,7 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(100f32), @@ -323,6 +343,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: auto() }, ..Default::default() @@ -334,6 +358,10 @@ fn width_smaller_then_content_with_flex_grow_very_large_size__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/wrap_child.rs b/tests/generated/flex/wrap_child.rs index 8b7a0ea0d..d3d982418 100644 --- a/tests/generated/flex/wrap_child.rs +++ b/tests/generated/flex/wrap_child.rs @@ -6,6 +6,7 @@ fn wrap_child__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -15,7 +16,14 @@ fn wrap_child__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -120,6 +128,7 @@ fn wrap_child__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -132,6 +141,10 @@ fn wrap_child__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/flex/wrap_column.rs b/tests/generated/flex/wrap_column.rs index 2a44d81f5..df7a1cdcd 100644 --- a/tests/generated/flex/wrap_column.rs +++ b/tests/generated/flex/wrap_column.rs @@ -6,6 +6,7 @@ fn wrap_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(31f32), @@ -15,6 +16,7 @@ fn wrap_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(32f32), @@ -24,6 +26,7 @@ fn wrap_column__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(33f32), @@ -33,6 +36,7 @@ fn wrap_column__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(34f32), @@ -45,6 +49,10 @@ fn wrap_column__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -266,6 +274,7 @@ fn wrap_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(31f32), @@ -276,6 +285,7 @@ fn wrap_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(32f32), @@ -286,6 +296,7 @@ fn wrap_column__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(33f32), @@ -296,6 +307,7 @@ fn wrap_column__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(34f32), @@ -309,6 +321,10 @@ fn wrap_column__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/wrap_grandchild.rs b/tests/generated/flex/wrap_grandchild.rs index 26ca414d2..164e3aae7 100644 --- a/tests/generated/flex/wrap_grandchild.rs +++ b/tests/generated/flex/wrap_grandchild.rs @@ -6,6 +6,7 @@ fn wrap_grandchild__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -13,8 +14,30 @@ fn wrap_grandchild__border_box() { ..Default::default() }) .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(); + let node0 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node00], + ) + .unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -161,6 +184,7 @@ fn wrap_grandchild__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -170,13 +194,27 @@ fn wrap_grandchild__content_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); 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 d73df9cba..bbb696a31 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 @@ -6,6 +6,7 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -15,12 +16,20 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { .unwrap(); let node00 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node000], ) .unwrap(); let node010 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -32,6 +41,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -42,6 +55,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: auto() }, ..Default::default() }, @@ -52,6 +69,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -336,6 +357,7 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -348,6 +370,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node000], @@ -356,6 +382,7 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { let node010 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -368,6 +395,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: zero(), top: length(10f32), bottom: zero() }, ..Default::default() }, @@ -379,6 +410,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(70f32), height: auto() }, ..Default::default() }, @@ -390,6 +425,10 @@ fn wrap_nodes_with_content_sizing_margin_cross__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), 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 28e9f8c34..274ca8471 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 @@ -6,6 +6,7 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -15,12 +16,20 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { .unwrap(); let node00 = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node000], ) .unwrap(); let node010 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -32,6 +41,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() }, @@ -42,6 +55,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(85f32), height: auto() }, ..Default::default() }, @@ -52,6 +69,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), @@ -336,6 +357,7 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -348,6 +370,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node000], @@ -356,6 +382,7 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { let node010 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(40f32), @@ -368,6 +395,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: zero(), right: length(10f32), top: zero(), bottom: zero() }, ..Default::default() }, @@ -379,6 +410,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(85f32), height: auto() }, ..Default::default() }, @@ -390,6 +425,10 @@ fn wrap_nodes_with_content_sizing_overflowing_margin__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(500f32), height: taffy::style::Dimension::from_length(500f32), diff --git a/tests/generated/flex/wrap_reverse_column.rs b/tests/generated/flex/wrap_reverse_column.rs index 973356010..5c9d19cff 100644 --- a/tests/generated/flex/wrap_reverse_column.rs +++ b/tests/generated/flex/wrap_reverse_column.rs @@ -6,6 +6,7 @@ fn wrap_reverse_column__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(31f32), @@ -15,6 +16,7 @@ fn wrap_reverse_column__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(32f32), @@ -24,6 +26,7 @@ fn wrap_reverse_column__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(33f32), @@ -33,6 +36,7 @@ fn wrap_reverse_column__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(34f32), @@ -45,6 +49,10 @@ fn wrap_reverse_column__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -266,6 +274,7 @@ fn wrap_reverse_column__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(31f32), @@ -276,6 +285,7 @@ fn wrap_reverse_column__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(32f32), @@ -286,6 +296,7 @@ fn wrap_reverse_column__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(33f32), @@ -296,6 +307,7 @@ fn wrap_reverse_column__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(34f32), @@ -309,6 +321,10 @@ fn wrap_reverse_column__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/flex/wrap_reverse_column_fixed_size.rs b/tests/generated/flex/wrap_reverse_column_fixed_size.rs index e4e17723d..baf89d0d2 100644 --- a/tests/generated/flex/wrap_reverse_column_fixed_size.rs +++ b/tests/generated/flex/wrap_reverse_column_fixed_size.rs @@ -6,6 +6,7 @@ fn wrap_reverse_column_fixed_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_column_fixed_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_column_fixed_size__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_column_fixed_size__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_column_fixed_size__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -54,6 +59,10 @@ fn wrap_reverse_column_fixed_size__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -315,6 +324,7 @@ fn wrap_reverse_column_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -325,6 +335,7 @@ fn wrap_reverse_column_fixed_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -335,6 +346,7 @@ fn wrap_reverse_column_fixed_size__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -345,6 +357,7 @@ fn wrap_reverse_column_fixed_size__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -355,6 +368,7 @@ fn wrap_reverse_column_fixed_size__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -368,6 +382,10 @@ fn wrap_reverse_column_fixed_size__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/flex/wrap_reverse_row.rs b/tests/generated/flex/wrap_reverse_row.rs index 0baa4311b..20ea11f44 100644 --- a/tests/generated/flex/wrap_reverse_row.rs +++ b/tests/generated/flex/wrap_reverse_row.rs @@ -6,6 +6,7 @@ fn wrap_reverse_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(31f32), height: taffy::style::Dimension::from_length(30f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(32f32), height: taffy::style::Dimension::from_length(30f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(33f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(34f32), height: taffy::style::Dimension::from_length(30f32), @@ -44,6 +48,10 @@ fn wrap_reverse_row__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -262,6 +270,7 @@ fn wrap_reverse_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(31f32), height: taffy::style::Dimension::from_length(30f32), @@ -272,6 +281,7 @@ fn wrap_reverse_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(32f32), height: taffy::style::Dimension::from_length(30f32), @@ -282,6 +292,7 @@ fn wrap_reverse_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(33f32), height: taffy::style::Dimension::from_length(30f32), @@ -292,6 +303,7 @@ fn wrap_reverse_row__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(34f32), height: taffy::style::Dimension::from_length(30f32), @@ -304,6 +316,10 @@ fn wrap_reverse_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, 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 830b56bb2..71d407c2f 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_center.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_center.rs @@ -6,6 +6,7 @@ fn wrap_reverse_row_align_content_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row_align_content_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row_align_content_center__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row_align_content_center__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_row_align_content_center__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -53,6 +58,10 @@ fn wrap_reverse_row_align_content_center__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -311,6 +320,7 @@ fn wrap_reverse_row_align_content_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -321,6 +331,7 @@ fn wrap_reverse_row_align_content_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -331,6 +342,7 @@ fn wrap_reverse_row_align_content_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -341,6 +353,7 @@ fn wrap_reverse_row_align_content_center__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -351,6 +364,7 @@ fn wrap_reverse_row_align_content_center__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -363,6 +377,10 @@ fn wrap_reverse_row_align_content_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 1d939ac21..537365595 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 @@ -6,6 +6,7 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -53,6 +58,10 @@ fn wrap_reverse_row_align_content_flex_start__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -311,6 +320,7 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -321,6 +331,7 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -331,6 +342,7 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -341,6 +353,7 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -351,6 +364,7 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -363,6 +377,10 @@ fn wrap_reverse_row_align_content_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 0250d6c90..cc91575a9 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 @@ -6,6 +6,7 @@ fn wrap_reverse_row_align_content_space_around__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row_align_content_space_around__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row_align_content_space_around__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row_align_content_space_around__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_row_align_content_space_around__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -53,6 +58,10 @@ fn wrap_reverse_row_align_content_space_around__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -311,6 +320,7 @@ fn wrap_reverse_row_align_content_space_around__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -321,6 +331,7 @@ fn wrap_reverse_row_align_content_space_around__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -331,6 +342,7 @@ fn wrap_reverse_row_align_content_space_around__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -341,6 +353,7 @@ fn wrap_reverse_row_align_content_space_around__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -351,6 +364,7 @@ fn wrap_reverse_row_align_content_space_around__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -363,6 +377,10 @@ fn wrap_reverse_row_align_content_space_around__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 ec705638c..80c6efa36 100644 --- a/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs +++ b/tests/generated/flex/wrap_reverse_row_align_content_stretch.rs @@ -6,6 +6,7 @@ fn wrap_reverse_row_align_content_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row_align_content_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row_align_content_stretch__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row_align_content_stretch__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_row_align_content_stretch__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -53,6 +58,10 @@ fn wrap_reverse_row_align_content_stretch__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -311,6 +320,7 @@ fn wrap_reverse_row_align_content_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -321,6 +331,7 @@ fn wrap_reverse_row_align_content_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -331,6 +342,7 @@ fn wrap_reverse_row_align_content_stretch__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -341,6 +353,7 @@ fn wrap_reverse_row_align_content_stretch__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -351,6 +364,7 @@ fn wrap_reverse_row_align_content_stretch__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -363,6 +377,10 @@ fn wrap_reverse_row_align_content_stretch__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 7aed273bf..d97030876 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 @@ -6,6 +6,7 @@ fn wrap_reverse_row_single_line_different_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_reverse_row_single_line_different_size__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_reverse_row_single_line_different_size__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_reverse_row_single_line_different_size__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -42,6 +46,7 @@ fn wrap_reverse_row_single_line_different_size__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -53,6 +58,10 @@ fn wrap_reverse_row_single_line_different_size__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() @@ -311,6 +320,7 @@ fn wrap_reverse_row_single_line_different_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -321,6 +331,7 @@ fn wrap_reverse_row_single_line_different_size__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -331,6 +342,7 @@ fn wrap_reverse_row_single_line_different_size__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -341,6 +353,7 @@ fn wrap_reverse_row_single_line_different_size__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(40f32), @@ -351,6 +364,7 @@ fn wrap_reverse_row_single_line_different_size__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -363,6 +377,10 @@ fn wrap_reverse_row_single_line_different_size__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::WrapReverse, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(300f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/wrap_row.rs b/tests/generated/flex/wrap_row.rs index ab56159de..4bc57d7fd 100644 --- a/tests/generated/flex/wrap_row.rs +++ b/tests/generated/flex/wrap_row.rs @@ -6,6 +6,7 @@ fn wrap_row__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(31f32), height: taffy::style::Dimension::from_length(30f32), @@ -15,6 +16,7 @@ fn wrap_row__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(32f32), height: taffy::style::Dimension::from_length(30f32), @@ -24,6 +26,7 @@ fn wrap_row__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(33f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_row__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(34f32), height: taffy::style::Dimension::from_length(30f32), @@ -44,6 +48,10 @@ fn wrap_row__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, @@ -262,6 +270,7 @@ fn wrap_row__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(31f32), height: taffy::style::Dimension::from_length(30f32), @@ -272,6 +281,7 @@ fn wrap_row__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(32f32), height: taffy::style::Dimension::from_length(30f32), @@ -282,6 +292,7 @@ fn wrap_row__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(33f32), height: taffy::style::Dimension::from_length(30f32), @@ -292,6 +303,7 @@ fn wrap_row__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(34f32), height: taffy::style::Dimension::from_length(30f32), @@ -304,6 +316,10 @@ fn wrap_row__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/flex/wrap_row_align_items_center.rs b/tests/generated/flex/wrap_row_align_items_center.rs index 5a4f2b27e..b0788252d 100644 --- a/tests/generated/flex/wrap_row_align_items_center.rs +++ b/tests/generated/flex/wrap_row_align_items_center.rs @@ -6,6 +6,7 @@ fn wrap_row_align_items_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_row_align_items_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_row_align_items_center__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_row_align_items_center__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -44,6 +48,10 @@ fn wrap_row_align_items_center__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -263,6 +271,7 @@ fn wrap_row_align_items_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -273,6 +282,7 @@ fn wrap_row_align_items_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -283,6 +293,7 @@ fn wrap_row_align_items_center__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -293,6 +304,7 @@ fn wrap_row_align_items_center__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -305,6 +317,10 @@ fn wrap_row_align_items_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 0f17595aa..4721acc9c 100644 --- a/tests/generated/flex/wrap_row_align_items_flex_end.rs +++ b/tests/generated/flex/wrap_row_align_items_flex_end.rs @@ -6,6 +6,7 @@ fn wrap_row_align_items_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -15,6 +16,7 @@ fn wrap_row_align_items_flex_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -24,6 +26,7 @@ fn wrap_row_align_items_flex_end__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -33,6 +36,7 @@ fn wrap_row_align_items_flex_end__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -44,6 +48,10 @@ fn wrap_row_align_items_flex_end__border_box() { .new_with_children( taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -263,6 +271,7 @@ fn wrap_row_align_items_flex_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(10f32), @@ -273,6 +282,7 @@ fn wrap_row_align_items_flex_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(20f32), @@ -283,6 +293,7 @@ fn wrap_row_align_items_flex_end__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -293,6 +304,7 @@ fn wrap_row_align_items_flex_end__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(30f32), @@ -305,6 +317,10 @@ fn wrap_row_align_items_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() diff --git a/tests/generated/flex/wrapped_column_max_height.rs b/tests/generated/flex/wrapped_column_max_height.rs index d3aa057d8..5ae1ded37 100644 --- a/tests/generated/flex/wrapped_column_max_height.rs +++ b/tests/generated/flex/wrapped_column_max_height.rs @@ -6,6 +6,7 @@ fn wrapped_column_max_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(500f32), @@ -16,6 +17,7 @@ fn wrapped_column_max_height__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -31,6 +33,7 @@ fn wrapped_column_max_height__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -43,6 +46,10 @@ fn wrapped_column_max_height__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -246,6 +253,7 @@ fn wrapped_column_max_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(500f32), @@ -257,6 +265,7 @@ fn wrapped_column_max_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -273,6 +282,7 @@ fn wrapped_column_max_height__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -286,6 +296,10 @@ fn wrapped_column_max_height__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), diff --git a/tests/generated/flex/wrapped_column_max_height_flex.rs b/tests/generated/flex/wrapped_column_max_height_flex.rs index 9d4cfa134..84d039d6b 100644 --- a/tests/generated/flex/wrapped_column_max_height_flex.rs +++ b/tests/generated/flex/wrapped_column_max_height_flex.rs @@ -6,6 +6,7 @@ fn wrapped_column_max_height_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -19,6 +20,7 @@ fn wrapped_column_max_height_flex__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -37,6 +39,7 @@ fn wrapped_column_max_height_flex__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -49,6 +52,10 @@ fn wrapped_column_max_height_flex__border_box() { taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), @@ -252,6 +259,7 @@ fn wrapped_column_max_height_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -266,6 +274,7 @@ fn wrapped_column_max_height_flex__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, flex_shrink: 1f32, flex_basis: taffy::style::Dimension::from_percent(0f32), @@ -285,6 +294,7 @@ fn wrapped_column_max_height_flex__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -298,6 +308,10 @@ fn wrapped_column_max_height_flex__content_box() { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), 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 f6124063c..7d7dabd8d 100644 --- a/tests/generated/flex/wrapped_row_within_align_items_center.rs +++ b/tests/generated/flex/wrapped_row_within_align_items_center.rs @@ -6,6 +6,7 @@ fn wrapped_row_within_align_items_center__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -15,6 +16,7 @@ fn wrapped_row_within_align_items_center__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -24,7 +26,14 @@ fn wrapped_row_within_align_items_center__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() }, + taffy::style::Style { + flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00, node01], ) .unwrap(); @@ -32,6 +41,10 @@ fn wrapped_row_within_align_items_center__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -233,6 +246,7 @@ fn wrapped_row_within_align_items_center__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -243,6 +257,7 @@ fn wrapped_row_within_align_items_center__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -255,6 +270,10 @@ fn wrapped_row_within_align_items_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01], @@ -265,6 +284,10 @@ fn wrapped_row_within_align_items_center__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 178457a59..b0329d7a0 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 @@ -6,6 +6,7 @@ fn wrapped_row_within_align_items_flex_end__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -15,6 +16,7 @@ fn wrapped_row_within_align_items_flex_end__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -24,7 +26,14 @@ fn wrapped_row_within_align_items_flex_end__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() }, + taffy::style::Style { + flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00, node01], ) .unwrap(); @@ -32,6 +41,10 @@ fn wrapped_row_within_align_items_flex_end__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -233,6 +246,7 @@ fn wrapped_row_within_align_items_flex_end__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -243,6 +257,7 @@ fn wrapped_row_within_align_items_flex_end__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -255,6 +270,10 @@ fn wrapped_row_within_align_items_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01], @@ -265,6 +284,10 @@ fn wrapped_row_within_align_items_flex_end__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexEnd), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 ccb8dc97b..f06414cc5 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 @@ -6,6 +6,7 @@ fn wrapped_row_within_align_items_flex_start__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -15,6 +16,7 @@ fn wrapped_row_within_align_items_flex_start__border_box() { .unwrap(); let node01 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -24,7 +26,14 @@ fn wrapped_row_within_align_items_flex_start__border_box() { .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { flex_wrap: taffy::style::FlexWrap::Wrap, ..Default::default() }, + taffy::style::Style { + flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00, node01], ) .unwrap(); @@ -32,6 +41,10 @@ fn wrapped_row_within_align_items_flex_start__border_box() { .new_with_children( taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -233,6 +246,7 @@ fn wrapped_row_within_align_items_flex_start__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(150f32), height: taffy::style::Dimension::from_length(80f32), @@ -243,6 +257,7 @@ fn wrapped_row_within_align_items_flex_start__content_box() { let node01 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: taffy::style::Dimension::from_length(80f32), @@ -255,6 +270,10 @@ fn wrapped_row_within_align_items_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01], @@ -265,6 +284,10 @@ fn wrapped_row_within_align_items_flex_start__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::FlexStart), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/grid/chrome_issue_325928327.rs b/tests/generated/grid/chrome_issue_325928327.rs index c6cb755f8..39baf4707 100644 --- a/tests/generated/grid/chrome_issue_325928327.rs +++ b/tests/generated/grid/chrome_issue_325928327.rs @@ -6,6 +6,7 @@ fn chrome_issue_325928327__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, aspect_ratio: Some(1f32), ..Default::default() @@ -14,6 +15,10 @@ fn chrome_issue_325928327__border_box() { let node0 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() }, @@ -24,6 +29,10 @@ fn chrome_issue_325928327__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), @@ -174,6 +183,7 @@ fn chrome_issue_325928327__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, aspect_ratio: Some(1f32), ..Default::default() @@ -183,6 +193,10 @@ fn chrome_issue_325928327__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(1f32) }, ..Default::default() }, @@ -194,6 +208,10 @@ fn chrome_issue_325928327__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), 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 e839763e2..33f7e36f0 100644 --- a/tests/generated/grid/grid_absolute_align_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_align_self_sized_all.rs @@ -7,6 +7,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -29,6 +31,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -40,6 +43,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -51,6 +55,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node4 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -62,6 +67,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node5 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -73,6 +79,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node6 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -84,6 +91,7 @@ fn grid_absolute_align_self_sized_all__border_box() { let node7 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -96,6 +104,10 @@ fn grid_absolute_align_self_sized_all__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -476,6 +488,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -488,6 +501,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -500,6 +514,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -512,6 +527,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -524,6 +540,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -536,6 +553,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -548,6 +566,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -560,6 +579,7 @@ fn grid_absolute_align_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -573,6 +593,10 @@ fn grid_absolute_align_self_sized_all__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_absolute_column_end.rs b/tests/generated/grid/grid_absolute_column_end.rs index d07c47170..d010aaaa2 100644 --- a/tests/generated/grid/grid_absolute_column_end.rs +++ b/tests/generated/grid/grid_absolute_column_end.rs @@ -7,6 +7,7 @@ fn grid_absolute_column_end__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Auto, end: line(1i16) }, inset: taffy::geometry::Rect { left: length(4f32), @@ -21,6 +22,10 @@ fn grid_absolute_column_end__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -136,6 +141,7 @@ fn grid_absolute_column_end__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Auto, end: line(1i16) }, inset: taffy::geometry::Rect { left: length(4f32), @@ -151,6 +157,10 @@ fn grid_absolute_column_end__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_column_start.rs b/tests/generated/grid/grid_absolute_column_start.rs index 487c7934e..244287603 100644 --- a/tests/generated/grid/grid_absolute_column_start.rs +++ b/tests/generated/grid/grid_absolute_column_start.rs @@ -7,6 +7,7 @@ fn grid_absolute_column_start__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, inset: taffy::geometry::Rect { left: length(4f32), @@ -21,6 +22,10 @@ fn grid_absolute_column_start__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -136,6 +141,7 @@ fn grid_absolute_column_start__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, inset: taffy::geometry::Rect { left: length(4f32), @@ -151,6 +157,10 @@ fn grid_absolute_column_start__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_container_bottom_left.rs b/tests/generated/grid/grid_absolute_container_bottom_left.rs index e017e3d61..dc4544335 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left.rs @@ -7,22 +7,67 @@ fn grid_absolute_container_bottom_left__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: auto(), bottom: length(0f32) }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -444,39 +489,76 @@ fn grid_absolute_container_bottom_left__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: auto(), bottom: length(0f32) }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 dad403b84..d3093cf6f 100644 --- a/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs +++ b/tests/generated/grid/grid_absolute_container_bottom_left_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_bottom_left_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -21,18 +22,62 @@ fn grid_absolute_container_bottom_left_margin__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -454,6 +499,7 @@ fn grid_absolute_container_bottom_left_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -469,34 +515,70 @@ fn grid_absolute_container_bottom_left_margin__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 c548e43b2..3e573995b 100644 --- a/tests/generated/grid/grid_absolute_container_left_overrides_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_overrides_right.rs @@ -7,23 +7,68 @@ fn grid_absolute_container_left_overrides_right__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: length(5f32), right: length(2f32), top: auto(), bottom: auto() }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -445,40 +490,77 @@ fn grid_absolute_container_left_overrides_right__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, inset: taffy::geometry::Rect { left: length(5f32), right: length(2f32), top: auto(), bottom: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_container_left_right.rs b/tests/generated/grid/grid_absolute_container_left_right.rs index 20dcada24..147257971 100644 --- a/tests/generated/grid/grid_absolute_container_left_right.rs +++ b/tests/generated/grid/grid_absolute_container_left_right.rs @@ -7,22 +7,67 @@ fn grid_absolute_container_left_right__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(5f32), right: length(2f32), top: auto(), bottom: auto() }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -444,39 +489,76 @@ fn grid_absolute_container_left_right__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(5f32), right: length(2f32), top: auto(), bottom: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 1c8a4fee7..9f3a60eec 100644 --- a/tests/generated/grid/grid_absolute_container_left_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_left_right_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_left_right_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -17,18 +18,62 @@ fn grid_absolute_container_left_right_margin__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,6 +495,7 @@ fn grid_absolute_container_left_right_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -461,34 +507,70 @@ fn grid_absolute_container_left_right_margin__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_container_negative_position.rs b/tests/generated/grid/grid_absolute_container_negative_position.rs index c87c8a5d3..7c5f53706 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_negative_position__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(-15f32), top: length(-5f32), bottom: auto() }, ..Default::default() }) @@ -14,21 +15,61 @@ fn grid_absolute_container_negative_position__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(-35f32), right: auto(), top: auto(), bottom: length(-25f32) }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,6 +491,7 @@ fn grid_absolute_container_negative_position__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(-15f32), top: length(-5f32), bottom: auto() }, ..Default::default() }) @@ -458,36 +500,69 @@ fn grid_absolute_container_negative_position__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(-35f32), right: auto(), top: auto(), bottom: length(-25f32) }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 4fd9914af..0b0dba2e5 100644 --- a/tests/generated/grid/grid_absolute_container_negative_position_margin.rs +++ b/tests/generated/grid/grid_absolute_container_negative_position_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_negative_position_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -20,6 +21,7 @@ fn grid_absolute_container_negative_position_margin__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -30,17 +32,56 @@ fn grid_absolute_container_negative_position_margin__border_box() { ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -462,6 +503,7 @@ fn grid_absolute_container_negative_position_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -476,6 +518,7 @@ fn grid_absolute_container_negative_position_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -487,31 +530,63 @@ fn grid_absolute_container_negative_position_margin__content_box() { }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_container_top_bottom.rs b/tests/generated/grid/grid_absolute_container_top_bottom.rs index bab30cbfa..9e1ac7a31 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom.rs @@ -7,22 +7,67 @@ fn grid_absolute_container_top_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(2f32), bottom: length(5f32) }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,39 +495,76 @@ fn grid_absolute_container_top_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(2f32), bottom: length(5f32) }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 490ba3cc8..9b4429c0e 100644 --- a/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_bottom_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_top_bottom_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -17,18 +18,62 @@ fn grid_absolute_container_top_bottom_margin__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -456,6 +501,7 @@ fn grid_absolute_container_top_bottom_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -467,34 +513,70 @@ fn grid_absolute_container_top_bottom_margin__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_container_top_right.rs b/tests/generated/grid/grid_absolute_container_top_right.rs index cc6dae1b3..9defa8657 100644 --- a/tests/generated/grid/grid_absolute_container_top_right.rs +++ b/tests/generated/grid/grid_absolute_container_top_right.rs @@ -7,22 +7,67 @@ fn grid_absolute_container_top_right__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(0f32), top: length(0f32), bottom: auto() }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -444,39 +489,76 @@ fn grid_absolute_container_top_right__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(0f32), top: length(0f32), bottom: auto() }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 a03133dc9..302dc955a 100644 --- a/tests/generated/grid/grid_absolute_container_top_right_margin.rs +++ b/tests/generated/grid/grid_absolute_container_top_right_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_container_top_right_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -17,18 +18,62 @@ fn grid_absolute_container_top_right_margin__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,6 +495,7 @@ fn grid_absolute_container_top_right_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -461,34 +507,70 @@ fn grid_absolute_container_top_right_margin__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 cf3ce6682..e1ebd687e 100644 --- a/tests/generated/grid/grid_absolute_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_absolute_justify_self_sized_all.rs @@ -7,6 +7,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -29,6 +31,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -40,6 +43,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -51,6 +55,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node4 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -62,6 +67,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node5 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -73,6 +79,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node6 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -84,6 +91,7 @@ fn grid_absolute_justify_self_sized_all__border_box() { let node7 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -96,6 +104,10 @@ fn grid_absolute_justify_self_sized_all__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -476,6 +488,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -488,6 +501,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -500,6 +514,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -512,6 +527,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -524,6 +540,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -536,6 +553,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -548,6 +566,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -560,6 +579,7 @@ fn grid_absolute_justify_self_sized_all__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -573,6 +593,10 @@ fn grid_absolute_justify_self_sized_all__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_absolute_layout_within_border.rs b/tests/generated/grid/grid_absolute_layout_within_border.rs index 16283c512..9b90db7f6 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border.rs @@ -7,6 +7,7 @@ fn grid_absolute_layout_within_border__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,7 @@ fn grid_absolute_layout_within_border__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -29,6 +31,7 @@ fn grid_absolute_layout_within_border__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -46,6 +49,7 @@ fn grid_absolute_layout_within_border__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -64,6 +68,10 @@ fn grid_absolute_layout_within_border__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -298,6 +306,7 @@ fn grid_absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -310,6 +319,7 @@ fn grid_absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -322,6 +332,7 @@ fn grid_absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -340,6 +351,7 @@ fn grid_absolute_layout_within_border__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -359,6 +371,10 @@ fn grid_absolute_layout_within_border__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 9cdfb74d4..b1b64116e 100644 --- a/tests/generated/grid/grid_absolute_layout_within_border_static.rs +++ b/tests/generated/grid/grid_absolute_layout_within_border_static.rs @@ -7,6 +7,7 @@ fn grid_absolute_layout_within_border_static__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -19,6 +20,7 @@ fn grid_absolute_layout_within_border_static__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -31,6 +33,7 @@ fn grid_absolute_layout_within_border_static__border_box() { let node2 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -49,6 +52,7 @@ fn grid_absolute_layout_within_border_static__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -68,6 +72,10 @@ fn grid_absolute_layout_within_border_static__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -302,6 +310,7 @@ fn grid_absolute_layout_within_border_static__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -315,6 +324,7 @@ fn grid_absolute_layout_within_border_static__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -328,6 +338,7 @@ fn grid_absolute_layout_within_border_static__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -347,6 +358,7 @@ fn grid_absolute_layout_within_border_static__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -367,6 +379,10 @@ fn grid_absolute_layout_within_border_static__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_absolute_overflow_clip.rs b/tests/generated/grid/grid_absolute_overflow_clip.rs index 349f6d94d..644e4350d 100644 --- a/tests/generated/grid/grid_absolute_overflow_clip.rs +++ b/tests/generated/grid/grid_absolute_overflow_clip.rs @@ -8,6 +8,10 @@ fn grid_absolute_overflow_clip__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -28,7 +32,6 @@ fn grid_absolute_overflow_clip__border_box() { taffy::style::Style { display: taffy::style::Display::Grid, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -153,6 +156,10 @@ fn grid_absolute_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -174,7 +181,6 @@ fn grid_absolute_overflow_clip__content_box() { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_absolute_overflow_hidden.rs b/tests/generated/grid/grid_absolute_overflow_hidden.rs index 699964204..f13cc5968 100644 --- a/tests/generated/grid/grid_absolute_overflow_hidden.rs +++ b/tests/generated/grid/grid_absolute_overflow_hidden.rs @@ -8,6 +8,10 @@ fn grid_absolute_overflow_hidden__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -156,6 +160,10 @@ fn grid_absolute_overflow_hidden__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_absolute_overflow_scroll.rs b/tests/generated/grid/grid_absolute_overflow_scroll.rs index 914601864..569f46ce9 100644 --- a/tests/generated/grid/grid_absolute_overflow_scroll.rs +++ b/tests/generated/grid/grid_absolute_overflow_scroll.rs @@ -8,6 +8,10 @@ fn grid_absolute_overflow_scroll__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -156,6 +160,10 @@ fn grid_absolute_overflow_scroll__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_absolute_overflow_visible.rs b/tests/generated/grid/grid_absolute_overflow_visible.rs index 61b86d6e5..606730254 100644 --- a/tests/generated/grid/grid_absolute_overflow_visible.rs +++ b/tests/generated/grid/grid_absolute_overflow_visible.rs @@ -8,6 +8,10 @@ fn grid_absolute_overflow_visible__border_box() { .new_leaf_with_context( taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -27,6 +31,10 @@ fn grid_absolute_overflow_visible__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -151,6 +159,10 @@ fn grid_absolute_overflow_visible__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -171,6 +183,10 @@ fn grid_absolute_overflow_visible__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_absolute_resolved_insets.rs b/tests/generated/grid/grid_absolute_resolved_insets.rs index 5a5873ace..908d21ee8 100644 --- a/tests/generated/grid/grid_absolute_resolved_insets.rs +++ b/tests/generated/grid/grid_absolute_resolved_insets.rs @@ -7,6 +7,7 @@ fn grid_absolute_resolved_insets__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -19,6 +20,7 @@ fn grid_absolute_resolved_insets__border_box() { let node01 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -26,6 +28,7 @@ fn grid_absolute_resolved_insets__border_box() { let node02 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -33,6 +36,7 @@ fn grid_absolute_resolved_insets__border_box() { let node03 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -40,6 +44,7 @@ fn grid_absolute_resolved_insets__border_box() { let node04 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -47,6 +52,7 @@ fn grid_absolute_resolved_insets__border_box() { let node05 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -59,6 +65,10 @@ fn grid_absolute_resolved_insets__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -83,6 +93,7 @@ fn grid_absolute_resolved_insets__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -95,6 +106,7 @@ fn grid_absolute_resolved_insets__border_box() { let node11 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -102,6 +114,7 @@ fn grid_absolute_resolved_insets__border_box() { let node12 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -109,6 +122,7 @@ fn grid_absolute_resolved_insets__border_box() { let node13 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -116,6 +130,7 @@ fn grid_absolute_resolved_insets__border_box() { let node14 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -123,6 +138,7 @@ fn grid_absolute_resolved_insets__border_box() { let node15 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -161,7 +177,18 @@ fn grid_absolute_resolved_insets__border_box() { &[node10, node11, node12, node13, node14, node15], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0, node1]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0, node1], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -789,6 +816,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -802,6 +830,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -810,6 +839,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -818,6 +848,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -826,6 +857,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -834,6 +866,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -847,6 +880,10 @@ fn grid_absolute_resolved_insets__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: taffy::style::Dimension::from_length(200f32), @@ -872,6 +909,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: auto(), @@ -885,6 +923,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(0f32), right: auto(), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -893,6 +932,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: percent(1f32), right: auto(), top: percent(1f32), bottom: auto() }, ..Default::default() }) @@ -901,6 +941,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: percent(1f32), top: auto(), bottom: percent(1f32) }, ..Default::default() }) @@ -909,6 +950,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(30f32), right: auto(), top: length(30f32), bottom: auto() }, ..Default::default() }) @@ -917,6 +959,7 @@ fn grid_absolute_resolved_insets__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(1f32), height: taffy::style::Dimension::from_percent(1f32), @@ -958,7 +1001,14 @@ fn grid_absolute_resolved_insets__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); diff --git a/tests/generated/grid/grid_absolute_row_end.rs b/tests/generated/grid/grid_absolute_row_end.rs index 05e957fc1..f7fc44099 100644 --- a/tests/generated/grid/grid_absolute_row_end.rs +++ b/tests/generated/grid/grid_absolute_row_end.rs @@ -7,6 +7,7 @@ fn grid_absolute_row_end__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: taffy::style::GridPlacement::Auto, end: line(1i16) }, inset: taffy::geometry::Rect { left: length(4f32), @@ -21,6 +22,10 @@ fn grid_absolute_row_end__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -130,6 +135,7 @@ fn grid_absolute_row_end__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: taffy::style::GridPlacement::Auto, end: line(1i16) }, inset: taffy::geometry::Rect { left: length(4f32), @@ -145,6 +151,10 @@ fn grid_absolute_row_end__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_row_start.rs b/tests/generated/grid/grid_absolute_row_start.rs index ec683968d..db0625a22 100644 --- a/tests/generated/grid/grid_absolute_row_start.rs +++ b/tests/generated/grid/grid_absolute_row_start.rs @@ -7,6 +7,7 @@ fn grid_absolute_row_start__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, inset: taffy::geometry::Rect { left: length(4f32), @@ -21,6 +22,10 @@ fn grid_absolute_row_start__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -136,6 +141,7 @@ fn grid_absolute_row_start__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, inset: taffy::geometry::Rect { left: length(4f32), @@ -151,6 +157,10 @@ fn grid_absolute_row_start__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs index 0bcccfb30..f9c39a425 100644 --- a/tests/generated/grid/grid_absolute_top_overrides_bottom.rs +++ b/tests/generated/grid/grid_absolute_top_overrides_bottom.rs @@ -7,23 +7,68 @@ fn grid_absolute_top_overrides_bottom__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(2f32), bottom: length(5f32) }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -445,40 +490,77 @@ fn grid_absolute_top_overrides_bottom__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, inset: taffy::geometry::Rect { left: auto(), right: auto(), top: length(2f32), bottom: length(5f32) }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_absolute_with_padding.rs b/tests/generated/grid/grid_absolute_with_padding.rs index 4de8dd532..3cf6e80c2 100644 --- a/tests/generated/grid/grid_absolute_with_padding.rs +++ b/tests/generated/grid/grid_absolute_with_padding.rs @@ -7,6 +7,7 @@ fn grid_absolute_with_padding__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(0f32), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -14,21 +15,61 @@ fn grid_absolute_with_padding__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: auto(), top: auto(), bottom: length(10f32) }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,6 +491,7 @@ fn grid_absolute_with_padding__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: auto(), right: length(0f32), top: length(0f32), bottom: auto() }, ..Default::default() }) @@ -458,36 +500,69 @@ fn grid_absolute_with_padding__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, inset: taffy::geometry::Rect { left: length(10f32), right: auto(), top: auto(), bottom: length(10f32) }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 40f952091..df2d3d587 100644 --- a/tests/generated/grid/grid_absolute_with_padding_and_margin.rs +++ b/tests/generated/grid/grid_absolute_with_padding_and_margin.rs @@ -7,6 +7,7 @@ fn grid_absolute_with_padding_and_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -20,6 +21,7 @@ fn grid_absolute_with_padding_and_margin__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -30,17 +32,56 @@ fn grid_absolute_with_padding_and_margin__border_box() { ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -462,6 +503,7 @@ fn grid_absolute_with_padding_and_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -476,6 +518,7 @@ fn grid_absolute_with_padding_and_margin__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, margin: taffy::geometry::Rect { left: length(4f32), right: length(2f32), @@ -487,31 +530,63 @@ fn grid_absolute_with_padding_and_margin__content_box() { }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_align_content_center.rs b/tests/generated/grid/grid_align_content_center.rs index 001c34e62..480d32fc6 100644 --- a/tests/generated/grid/grid_align_content_center.rs +++ b/tests/generated/grid/grid_align_content_center.rs @@ -4,19 +4,68 @@ fn grid_align_content_center__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_center__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 2af8f00f0..acf8a1020 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 @@ -4,19 +4,68 @@ fn grid_align_content_center_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_center_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_center_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_center_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), diff --git a/tests/generated/grid/grid_align_content_end.rs b/tests/generated/grid/grid_align_content_end.rs index 5e0ae25fd..bd166aedb 100644 --- a/tests/generated/grid/grid_align_content_end.rs +++ b/tests/generated/grid/grid_align_content_end.rs @@ -4,19 +4,68 @@ fn grid_align_content_end__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_end__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 9169255de..50a72561b 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 @@ -4,19 +4,68 @@ fn grid_align_content_end_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_end_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_end_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_end_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 4361c5c0e..2cad8f7ef 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 @@ -4,19 +4,68 @@ fn grid_align_content_end_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_align_content_end_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_content_space_around.rs b/tests/generated/grid/grid_align_content_space_around.rs index c9ecb822b..ec2a9d478 100644 --- a/tests/generated/grid/grid_align_content_space_around.rs +++ b/tests/generated/grid/grid_align_content_space_around.rs @@ -4,19 +4,68 @@ fn grid_align_content_space_around__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_space_around__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 6b6370ddf..991ed293d 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_around_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_space_around_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_space_around_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_space_around_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 1abc0e371..abe82adc2 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_around_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_align_content_space_around_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_content_space_between.rs b/tests/generated/grid/grid_align_content_space_between.rs index 06457fe88..d29b5e0c9 100644 --- a/tests/generated/grid/grid_align_content_space_between.rs +++ b/tests/generated/grid/grid_align_content_space_between.rs @@ -4,19 +4,68 @@ fn grid_align_content_space_between__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_space_between__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 c58d965f0..b57a14cc4 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_between_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_space_between_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_space_between_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_space_between_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 b6bb48136..882702e0f 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_between_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_align_content_space_between_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_content_space_evenly.rs b/tests/generated/grid/grid_align_content_space_evenly.rs index ca6429d34..1f30d5fcb 100644 --- a/tests/generated/grid/grid_align_content_space_evenly.rs +++ b/tests/generated/grid/grid_align_content_space_evenly.rs @@ -4,19 +4,68 @@ fn grid_align_content_space_evenly__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_space_evenly__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 aff60796d..a8c85970c 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_evenly_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_space_evenly_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_space_evenly_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceBetween), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_space_evenly_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 1400a5b89..726947f94 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 @@ -4,19 +4,68 @@ fn grid_align_content_space_evenly_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_align_content_space_evenly_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_content_start.rs b/tests/generated/grid/grid_align_content_start.rs index 41f2f17fd..917870779 100644 --- a/tests/generated/grid/grid_align_content_start.rs +++ b/tests/generated/grid/grid_align_content_start.rs @@ -4,19 +4,68 @@ fn grid_align_content_start__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_align_content_start__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 3316f5df7..d48ae9abb 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 @@ -4,19 +4,68 @@ fn grid_align_content_start_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_align_content_start_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_align_content_start_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_align_content_start_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 b381e8842..6cebdb498 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 @@ -4,19 +4,68 @@ fn grid_align_content_start_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_align_content_start_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_items_baseline.rs b/tests/generated/grid/grid_align_items_baseline.rs index 151983c22..f1dc824c3 100644 --- a/tests/generated/grid/grid_align_items_baseline.rs +++ b/tests/generated/grid/grid_align_items_baseline.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline__border_box() { let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -173,6 +179,7 @@ fn grid_align_items_baseline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -184,6 +191,7 @@ fn grid_align_items_baseline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -196,6 +204,10 @@ fn grid_align_items_baseline__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_align_items_baseline_child.rs b/tests/generated/grid/grid_align_items_baseline_child.rs index b5257a735..af011be91 100644 --- a/tests/generated/grid/grid_align_items_baseline_child.rs +++ b/tests/generated/grid/grid_align_items_baseline_child.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -41,6 +47,10 @@ fn grid_align_items_baseline_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -231,6 +241,7 @@ fn grid_align_items_baseline_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -242,6 +253,7 @@ fn grid_align_items_baseline_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -254,6 +266,10 @@ fn grid_align_items_baseline_child__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -268,6 +284,10 @@ fn grid_align_items_baseline_child__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 88e5180ad..9f4f78310 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_margin.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_margin.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_margin__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -23,6 +24,7 @@ fn grid_align_items_baseline_child_margin__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -40,6 +42,10 @@ fn grid_align_items_baseline_child_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -53,6 +59,10 @@ fn grid_align_items_baseline_child_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -243,6 +253,7 @@ fn grid_align_items_baseline_child_margin__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -260,6 +271,7 @@ fn grid_align_items_baseline_child_margin__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -278,6 +290,10 @@ fn grid_align_items_baseline_child_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -292,6 +308,10 @@ fn grid_align_items_baseline_child_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 9a2c566d9..736948e26 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 @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_margin_percent__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -23,6 +24,7 @@ fn grid_align_items_baseline_child_margin_percent__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -40,6 +42,10 @@ fn grid_align_items_baseline_child_margin_percent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -53,6 +59,10 @@ fn grid_align_items_baseline_child_margin_percent__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -243,6 +253,7 @@ fn grid_align_items_baseline_child_margin_percent__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -260,6 +271,7 @@ fn grid_align_items_baseline_child_margin_percent__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -278,6 +290,10 @@ fn grid_align_items_baseline_child_margin_percent__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -292,6 +308,10 @@ fn grid_align_items_baseline_child_margin_percent__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 130497d54..170545377 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_multiline.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_multiline__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child_multiline__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -27,6 +29,7 @@ fn grid_align_items_baseline_child_multiline__border_box() { let node11 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -37,6 +40,7 @@ fn grid_align_items_baseline_child_multiline__border_box() { let node12 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -47,6 +51,7 @@ fn grid_align_items_baseline_child_multiline__border_box() { let node13 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -59,6 +64,10 @@ fn grid_align_items_baseline_child_multiline__border_box() { taffy::style::Style { display: taffy::style::Display::Grid, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -70,6 +79,10 @@ fn grid_align_items_baseline_child_multiline__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() @@ -392,6 +405,7 @@ fn grid_align_items_baseline_child_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -403,6 +417,7 @@ fn grid_align_items_baseline_child_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -414,6 +429,7 @@ fn grid_align_items_baseline_child_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -425,6 +441,7 @@ fn grid_align_items_baseline_child_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -436,6 +453,7 @@ fn grid_align_items_baseline_child_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -449,6 +467,10 @@ fn grid_align_items_baseline_child_multiline__content_box() { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, flex_wrap: taffy::style::FlexWrap::Wrap, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -461,6 +483,10 @@ fn grid_align_items_baseline_child_multiline__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() 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 d67fb6779..23a045cb1 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 @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -27,6 +29,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b let node11 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -37,6 +40,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b let node12 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -47,6 +51,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b let node13 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -59,6 +64,10 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -73,6 +82,10 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__border_b .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -398,6 +411,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -409,6 +423,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -420,6 +435,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(10f32), @@ -431,6 +447,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -442,6 +459,7 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -455,6 +473,10 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -470,6 +492,10 @@ fn grid_align_items_baseline_child_multiline_no_override_on_secondline__content_ taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 4ababf357..5f9c2388d 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 @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -27,6 +29,7 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { let node11 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -38,6 +41,7 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { let node12 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -48,6 +52,7 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { let node13 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -60,6 +65,10 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -74,6 +83,10 @@ fn grid_align_items_baseline_child_multiline_override__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -399,6 +412,7 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -410,6 +424,7 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -421,6 +436,7 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -433,6 +449,7 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), height: taffy::style::Dimension::from_length(20f32), @@ -444,6 +461,7 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(25f32), @@ -457,6 +475,10 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), @@ -472,6 +494,10 @@ fn grid_align_items_baseline_child_multiline_override__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 57dbb3d85..5c9ca75f5 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_padding.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_padding.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_padding__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child_padding__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_child_padding__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -47,6 +53,10 @@ fn grid_align_items_baseline_child_padding__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -243,6 +253,7 @@ fn grid_align_items_baseline_child_padding__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -254,6 +265,7 @@ fn grid_align_items_baseline_child_padding__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -266,6 +278,10 @@ fn grid_align_items_baseline_child_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -286,6 +302,10 @@ fn grid_align_items_baseline_child_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 83e231315..aca4fa06d 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_top__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,7 @@ fn grid_align_items_baseline_child_top__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -29,6 +31,10 @@ fn grid_align_items_baseline_child_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +48,10 @@ fn grid_align_items_baseline_child_top__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -232,6 +242,7 @@ fn grid_align_items_baseline_child_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -244,6 +255,7 @@ fn grid_align_items_baseline_child_top__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -256,6 +268,10 @@ fn grid_align_items_baseline_child_top__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -270,6 +286,10 @@ fn grid_align_items_baseline_child_top__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), 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 919b53851..ba006ce3e 100644 --- a/tests/generated/grid/grid_align_items_baseline_child_top2.rs +++ b/tests/generated/grid/grid_align_items_baseline_child_top2.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_child_top2__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_child_top2__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_child_top2__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -42,6 +48,10 @@ fn grid_align_items_baseline_child_top2__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -232,6 +242,7 @@ fn grid_align_items_baseline_child_top2__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -243,6 +254,7 @@ fn grid_align_items_baseline_child_top2__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -255,6 +267,10 @@ fn grid_align_items_baseline_child_top2__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -270,6 +286,10 @@ fn grid_align_items_baseline_child_top2__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_align_items_baseline_complex.rs b/tests/generated/grid/grid_align_items_baseline_complex.rs index da27ecdb6..e3fce926a 100644 --- a/tests/generated/grid/grid_align_items_baseline_complex.rs +++ b/tests/generated/grid/grid_align_items_baseline_complex.rs @@ -6,6 +6,7 @@ fn grid_align_items_baseline_complex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -15,6 +16,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node10 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -22,6 +24,10 @@ fn grid_align_items_baseline_complex__border_box() { let node1 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -33,6 +39,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node20 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -40,6 +47,10 @@ fn grid_align_items_baseline_complex__border_box() { let node2 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -51,6 +62,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -60,6 +72,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -69,6 +82,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -78,6 +92,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node60 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -85,6 +100,10 @@ fn grid_align_items_baseline_complex__border_box() { let node6 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -96,6 +115,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node70 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(5f32) }, ..Default::default() }) @@ -103,6 +123,10 @@ fn grid_align_items_baseline_complex__border_box() { let node7 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -114,6 +138,7 @@ fn grid_align_items_baseline_complex__border_box() { .unwrap(); let node8 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -125,6 +150,10 @@ fn grid_align_items_baseline_complex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -718,6 +747,7 @@ fn grid_align_items_baseline_complex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -728,6 +758,7 @@ fn grid_align_items_baseline_complex__content_box() { let node10 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -736,6 +767,10 @@ fn grid_align_items_baseline_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -748,6 +783,7 @@ fn grid_align_items_baseline_complex__content_box() { let node20 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -756,6 +792,10 @@ fn grid_align_items_baseline_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -768,6 +808,7 @@ fn grid_align_items_baseline_complex__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -778,6 +819,7 @@ fn grid_align_items_baseline_complex__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -788,6 +830,7 @@ fn grid_align_items_baseline_complex__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -798,6 +841,7 @@ fn grid_align_items_baseline_complex__content_box() { let node60 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(10f32) }, ..Default::default() }) @@ -806,6 +850,10 @@ fn grid_align_items_baseline_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -818,6 +866,7 @@ fn grid_align_items_baseline_complex__content_box() { let node70 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(5f32) }, ..Default::default() }) @@ -826,6 +875,10 @@ fn grid_align_items_baseline_complex__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -838,6 +891,7 @@ fn grid_align_items_baseline_complex__content_box() { let node8 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -850,6 +904,10 @@ fn grid_align_items_baseline_complex__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 c2d8133d6..fb8d2a2ab 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 @@ -7,6 +7,7 @@ fn grid_align_items_baseline_double_nested_child__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -18,6 +19,10 @@ fn grid_align_items_baseline_double_nested_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -30,6 +35,7 @@ fn grid_align_items_baseline_double_nested_child__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -41,6 +47,10 @@ fn grid_align_items_baseline_double_nested_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -54,6 +64,10 @@ fn grid_align_items_baseline_double_nested_child__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -289,6 +303,7 @@ fn grid_align_items_baseline_double_nested_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -301,6 +316,10 @@ fn grid_align_items_baseline_double_nested_child__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -314,6 +333,7 @@ fn grid_align_items_baseline_double_nested_child__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(15f32), @@ -326,6 +346,10 @@ fn grid_align_items_baseline_double_nested_child__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -340,6 +364,10 @@ fn grid_align_items_baseline_double_nested_child__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_align_items_baseline_multiline.rs b/tests/generated/grid/grid_align_items_baseline_multiline.rs index f0600e199..b414d08fe 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_multiline__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_multiline__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -40,6 +46,7 @@ fn grid_align_items_baseline_multiline__border_box() { let node20 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +58,10 @@ fn grid_align_items_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -63,6 +74,7 @@ fn grid_align_items_baseline_multiline__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -74,6 +86,10 @@ fn grid_align_items_baseline_multiline__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { @@ -388,6 +404,7 @@ fn grid_align_items_baseline_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -399,6 +416,7 @@ fn grid_align_items_baseline_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +429,10 @@ fn grid_align_items_baseline_multiline__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -424,6 +446,7 @@ fn grid_align_items_baseline_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -436,6 +459,10 @@ fn grid_align_items_baseline_multiline__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -449,6 +476,7 @@ fn grid_align_items_baseline_multiline__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -461,6 +489,10 @@ fn grid_align_items_baseline_multiline__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { 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 9de404187..03b8d5e5c 100644 --- a/tests/generated/grid/grid_align_items_baseline_multiline_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_multiline_column.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_multiline_column__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_multiline_column__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_multiline_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -40,6 +46,7 @@ fn grid_align_items_baseline_multiline_column__border_box() { let node20 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +58,10 @@ fn grid_align_items_baseline_multiline_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -63,6 +74,7 @@ fn grid_align_items_baseline_multiline_column__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -74,6 +86,10 @@ fn grid_align_items_baseline_multiline_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { @@ -388,6 +404,7 @@ fn grid_align_items_baseline_multiline_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -399,6 +416,7 @@ fn grid_align_items_baseline_multiline_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -411,6 +429,10 @@ fn grid_align_items_baseline_multiline_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: taffy::style::Dimension::from_length(50f32), @@ -424,6 +446,7 @@ fn grid_align_items_baseline_multiline_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: taffy::style::Dimension::from_length(10f32), @@ -436,6 +459,10 @@ fn grid_align_items_baseline_multiline_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: taffy::style::Dimension::from_length(70f32), @@ -449,6 +476,7 @@ fn grid_align_items_baseline_multiline_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -461,6 +489,10 @@ fn grid_align_items_baseline_multiline_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { 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 10e270762..321fb2e1b 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 @@ -7,6 +7,7 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { let node10 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -28,6 +30,10 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -40,6 +46,7 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { let node20 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -51,6 +58,10 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -63,6 +74,7 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { let node3 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -74,6 +86,10 @@ fn grid_align_items_baseline_multiline_row_and_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { @@ -388,6 +404,7 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -399,6 +416,7 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -411,6 +429,10 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -424,6 +446,7 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(10f32), @@ -436,6 +459,10 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -449,6 +476,7 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(20f32), @@ -461,6 +489,10 @@ fn grid_align_items_baseline_multiline_row_and_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), grid_template_columns: vec![auto(), auto()], size: taffy::geometry::Size { 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 97425e788..e13a07f9e 100644 --- a/tests/generated/grid/grid_align_items_baseline_nested_column.rs +++ b/tests/generated/grid/grid_align_items_baseline_nested_column.rs @@ -7,6 +7,7 @@ fn grid_align_items_baseline_nested_column__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -17,6 +18,7 @@ fn grid_align_items_baseline_nested_column__border_box() { let node100 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(30f32), @@ -27,6 +29,7 @@ fn grid_align_items_baseline_nested_column__border_box() { let node101 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(40f32), @@ -38,6 +41,10 @@ fn grid_align_items_baseline_nested_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(80f32), @@ -49,7 +56,14 @@ fn grid_align_items_baseline_nested_column__border_box() { .unwrap(); let node1 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node10], ) .unwrap(); @@ -57,6 +71,10 @@ fn grid_align_items_baseline_nested_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), @@ -337,6 +355,7 @@ fn grid_align_items_baseline_nested_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(60f32), @@ -348,6 +367,7 @@ fn grid_align_items_baseline_nested_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(30f32), @@ -359,6 +379,7 @@ fn grid_align_items_baseline_nested_column__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(40f32), @@ -371,6 +392,10 @@ fn grid_align_items_baseline_nested_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(80f32), @@ -385,6 +410,10 @@ fn grid_align_items_baseline_nested_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node10], @@ -395,6 +424,10 @@ fn grid_align_items_baseline_nested_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Baseline), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_align_items_sized_center.rs b/tests/generated/grid/grid_align_items_sized_center.rs index 460e3f24b..59b4b3d92 100644 --- a/tests/generated/grid/grid_align_items_sized_center.rs +++ b/tests/generated/grid/grid_align_items_sized_center.rs @@ -6,6 +6,7 @@ fn grid_align_items_sized_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_align_items_sized_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_align_items_sized_center__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_align_items_sized_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_align_items_sized_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_align_items_sized_center__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_items_sized_end.rs b/tests/generated/grid/grid_align_items_sized_end.rs index 59c36d747..9e6ca4c7b 100644 --- a/tests/generated/grid/grid_align_items_sized_end.rs +++ b/tests/generated/grid/grid_align_items_sized_end.rs @@ -6,6 +6,7 @@ fn grid_align_items_sized_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_align_items_sized_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_align_items_sized_end__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_align_items_sized_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_align_items_sized_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_align_items_sized_end__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_items_sized_start.rs b/tests/generated/grid/grid_align_items_sized_start.rs index 4f002a3b2..da9ad646b 100644 --- a/tests/generated/grid/grid_align_items_sized_start.rs +++ b/tests/generated/grid/grid_align_items_sized_start.rs @@ -6,6 +6,7 @@ fn grid_align_items_sized_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_align_items_sized_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_align_items_sized_start__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_align_items_sized_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_align_items_sized_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_align_items_sized_start__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_items_sized_stretch.rs b/tests/generated/grid/grid_align_items_sized_stretch.rs index 5b4e790d8..054a5ba7b 100644 --- a/tests/generated/grid/grid_align_items_sized_stretch.rs +++ b/tests/generated/grid/grid_align_items_sized_stretch.rs @@ -6,6 +6,7 @@ fn grid_align_items_sized_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_align_items_sized_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_align_items_sized_stretch__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_align_items_sized_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_align_items_sized_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_align_items_sized_stretch__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_items: Some(taffy::style::AlignItems::Stretch), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_align_self_sized_all.rs b/tests/generated/grid/grid_align_self_sized_all.rs index b5ff34169..f286a3263 100644 --- a/tests/generated/grid/grid_align_self_sized_all.rs +++ b/tests/generated/grid/grid_align_self_sized_all.rs @@ -6,6 +6,7 @@ fn grid_align_self_sized_all__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -26,6 +28,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -36,6 +39,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -46,6 +50,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -56,6 +61,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -66,6 +72,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -76,6 +83,7 @@ fn grid_align_self_sized_all__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -88,6 +96,10 @@ fn grid_align_self_sized_all__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -467,6 +479,7 @@ fn grid_align_self_sized_all__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -478,6 +491,7 @@ fn grid_align_self_sized_all__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -489,6 +503,7 @@ fn grid_align_self_sized_all__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -500,6 +515,7 @@ fn grid_align_self_sized_all__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -511,6 +527,7 @@ fn grid_align_self_sized_all__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -522,6 +539,7 @@ fn grid_align_self_sized_all__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -533,6 +551,7 @@ fn grid_align_self_sized_all__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -544,6 +563,7 @@ fn grid_align_self_sized_all__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -557,6 +577,10 @@ fn grid_align_self_sized_all__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { 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 80519d21d..0d8074256 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 @@ -7,6 +7,7 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__borde let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -21,6 +22,10 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__borde .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__conte .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.05f32), @@ -147,6 +153,10 @@ fn grid_aspect_ratio_absolute_aspect_ratio_overrides_height_of_full_inset__conte taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 5689989f1..c8f07cc47 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 @@ -7,6 +7,7 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -21,6 +22,10 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -132,6 +137,7 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: percent(0.1f32), @@ -147,6 +153,10 @@ fn grid_aspect_ratio_absolute_fill_height_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 d2a921be0..3d00318fa 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 @@ -7,6 +7,7 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -16,6 +17,10 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -121,6 +126,7 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, ..Default::default() @@ -131,6 +137,10 @@ fn grid_aspect_ratio_absolute_fill_width_from_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 8b2e6c092..387a58176 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 @@ -7,6 +7,7 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -17,6 +18,10 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -122,6 +127,7 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_percent(0.1f32) }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { left: auto(), right: auto(), top: percent(0.3f32), bottom: percent(0.5f32) }, @@ -133,6 +139,10 @@ fn grid_aspect_ratio_absolute_height_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 5c2c52e71..a3f9f7fa6 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 @@ -7,6 +7,7 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__border_box() { let node0 = taffy .new_leaf(taffy::style::Style { position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -22,6 +23,10 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), @@ -127,6 +132,7 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__content_box() { .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, position: taffy::style::Position::Absolute, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.4f32), height: auto() }, aspect_ratio: Some(3f32), inset: taffy::geometry::Rect { @@ -143,6 +149,10 @@ fn grid_aspect_ratio_absolute_width_overrides_inset__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: taffy::style::Dimension::from_length(300f32), 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 91a7ce27a..e2539f6dc 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 @@ -6,19 +6,34 @@ fn grid_aspect_ratio_child_fill_content_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { aspect_ratio: Some(0.5f32), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + aspect_ratio: Some(0.5f32), + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -157,6 +172,10 @@ fn grid_aspect_ratio_child_fill_content_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, aspect_ratio: Some(0.5f32), ..Default::default() }, @@ -166,6 +185,7 @@ fn grid_aspect_ratio_child_fill_content_height__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) @@ -175,6 +195,10 @@ fn grid_aspect_ratio_child_fill_content_height__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 75d7ab091..a58b838b2 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 @@ -6,19 +6,34 @@ fn grid_aspect_ratio_child_fill_content_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { aspect_ratio: Some(2f32), ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + aspect_ratio: Some(2f32), + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0, node1], ) .unwrap(); @@ -157,6 +172,10 @@ fn grid_aspect_ratio_child_fill_content_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, aspect_ratio: Some(2f32), ..Default::default() }, @@ -166,6 +185,7 @@ fn grid_aspect_ratio_child_fill_content_width__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, ..Default::default() }) @@ -175,6 +195,10 @@ fn grid_aspect_ratio_child_fill_content_width__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0, node1], 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 2db0b592b..c3cce932f 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_height.rs @@ -6,6 +6,7 @@ fn grid_aspect_ratio_fill_child_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn grid_aspect_ratio_fill_child_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn grid_aspect_ratio_fill_child_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -129,6 +135,10 @@ fn grid_aspect_ratio_fill_child_height__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 b19c99645..ea10e77af 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 @@ -7,6 +7,10 @@ fn grid_aspect_ratio_fill_child_max_height__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -21,6 +25,10 @@ fn grid_aspect_ratio_fill_child_max_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -126,6 +134,10 @@ fn grid_aspect_ratio_fill_child_max_height__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -141,6 +153,10 @@ fn grid_aspect_ratio_fill_child_max_height__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 8258f7203..24689e86d 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 @@ -7,6 +7,10 @@ fn grid_aspect_ratio_fill_child_max_width__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -18,6 +22,10 @@ fn grid_aspect_ratio_fill_child_max_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -123,6 +131,10 @@ fn grid_aspect_ratio_fill_child_max_width__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -135,6 +147,10 @@ fn grid_aspect_ratio_fill_child_max_width__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 425ec90c4..ad408604c 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 @@ -6,6 +6,7 @@ fn grid_aspect_ratio_fill_child_min_height__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn grid_aspect_ratio_fill_child_min_height__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn grid_aspect_ratio_fill_child_min_height__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, aspect_ratio: Some(2f32), ..Default::default() @@ -129,6 +135,10 @@ fn grid_aspect_ratio_fill_child_min_height__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 45f971d99..82def5f67 100644 --- a/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs +++ b/tests/generated/grid/grid_aspect_ratio_fill_child_width.rs @@ -6,6 +6,7 @@ fn grid_aspect_ratio_fill_child_width__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -15,6 +16,10 @@ fn grid_aspect_ratio_fill_child_width__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -119,6 +124,7 @@ fn grid_aspect_ratio_fill_child_width__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(50f32) }, aspect_ratio: Some(2f32), ..Default::default() @@ -129,6 +135,10 @@ fn grid_aspect_ratio_fill_child_width__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs index 95a7538f8..6b6adc478 100644 --- a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs +++ b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes.rs @@ -6,6 +6,7 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,10 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -135,6 +141,10 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs index b3f47192e..ddb4e5170 100644 --- a/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs +++ b/tests/generated/grid/grid_aspect_ratio_overridden_by_explicit_sizes_flex.rs @@ -6,6 +6,7 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -18,6 +19,10 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -122,6 +127,7 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -135,6 +141,10 @@ fn grid_aspect_ratio_overridden_by_explicit_sizes_flex__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_auto_columns.rs b/tests/generated/grid/grid_auto_columns.rs index a678abade..d13998b09 100644 --- a/tests/generated/grid/grid_auto_columns.rs +++ b/tests/generated/grid/grid_auto_columns.rs @@ -6,21 +6,61 @@ fn grid_auto_columns__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(-3i16), end: taffy::style::GridPlacement::Auto }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(100f32)], grid_template_columns: vec![length(40f32)], grid_auto_columns: vec![length(10f32), length(20f32), length(30f32)], @@ -446,36 +486,69 @@ fn grid_auto_columns__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(-3i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(100f32)], grid_template_columns: vec![length(40f32)], grid_auto_columns: vec![length(10f32), length(20f32), length(30f32)], diff --git a/tests/generated/grid/grid_auto_columns_fixed_width.rs b/tests/generated/grid/grid_auto_columns_fixed_width.rs index 0235ef95c..b63ca6013 100644 --- a/tests/generated/grid/grid_auto_columns_fixed_width.rs +++ b/tests/generated/grid/grid_auto_columns_fixed_width.rs @@ -4,26 +4,110 @@ fn grid_auto_columns_fixed_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node9 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node10 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node11 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node12 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node13 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node14 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node15 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node9 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node10 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node11 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node12 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node13 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node14 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node15 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), auto(), length(40f32), auto()], grid_template_columns: vec![length(40f32), auto(), length(40f32), auto()], size: taffy::geometry::Size { @@ -752,58 +836,126 @@ fn grid_auto_columns_fixed_width__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node9 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node10 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node11 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node12 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node13 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node14 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node15 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), auto(), length(40f32), auto()], grid_template_columns: vec![length(40f32), auto(), length(40f32), auto()], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_auto_fill_fixed_size.rs b/tests/generated/grid/grid_auto_fill_fixed_size.rs index d6d26be54..0c06fb7d1 100644 --- a/tests/generated/grid/grid_auto_fill_fixed_size.rs +++ b/tests/generated/grid/grid_auto_fill_fixed_size.rs @@ -4,19 +4,68 @@ fn grid_auto_fill_fixed_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), repeat(RepetitionCount::AutoFill, vec![length(40f32)])], size: taffy::geometry::Size { @@ -433,37 +482,77 @@ fn grid_auto_fill_fixed_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), repeat(RepetitionCount::AutoFill, vec![length(40f32)])], size: taffy::geometry::Size { 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 cbcd367d3..67abcc815 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 @@ -4,12 +4,26 @@ fn grid_auto_fill_with_empty_auto_track__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![repeat(RepetitionCount::AutoFill, vec![length(40f32)])], @@ -154,16 +168,28 @@ fn grid_auto_fill_with_empty_auto_track__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![repeat(RepetitionCount::AutoFill, vec![length(40f32)])], diff --git a/tests/generated/grid/grid_auto_fit_definite_percentage.rs b/tests/generated/grid/grid_auto_fit_definite_percentage.rs index 779c86263..ad285e5e0 100644 --- a/tests/generated/grid/grid_auto_fit_definite_percentage.rs +++ b/tests/generated/grid/grid_auto_fit_definite_percentage.rs @@ -4,26 +4,70 @@ fn grid_auto_fit_definite_percentage__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node01 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node02 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node03 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node04 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node05 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node06 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); - let node07 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::Block, ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, grid_template_columns: vec![repeat(RepetitionCount::AutoFill, vec![minmax(length(150f32), fr(1f32))])], size: taffy::geometry::Size { @@ -44,6 +88,10 @@ fn grid_auto_fit_definite_percentage__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(730f32), height: taffy::style::Dimension::from_length(300f32), @@ -515,6 +563,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -522,6 +571,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -529,6 +579,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -536,6 +587,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -543,6 +595,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -550,6 +603,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -557,6 +611,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -564,6 +619,7 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); @@ -572,6 +628,10 @@ fn grid_auto_fit_definite_percentage__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, grid_template_columns: vec![repeat(RepetitionCount::AutoFill, vec![minmax(length(150f32), fr(1f32))])], size: taffy::geometry::Size { @@ -593,6 +653,10 @@ fn grid_auto_fit_definite_percentage__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(730f32), height: taffy::style::Dimension::from_length(300f32), 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 bde8634ec..b0be00c3e 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 @@ -4,12 +4,26 @@ fn grid_auto_fit_with_empty_auto_track__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![repeat(RepetitionCount::AutoFit, vec![length(40f32)])], @@ -154,16 +168,28 @@ fn grid_auto_fit_with_empty_auto_track__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![repeat(RepetitionCount::AutoFit, vec![length(40f32)])], diff --git a/tests/generated/grid/grid_auto_rows.rs b/tests/generated/grid/grid_auto_rows.rs index 713807ffb..c5421dd24 100644 --- a/tests/generated/grid/grid_auto_rows.rs +++ b/tests/generated/grid/grid_auto_rows.rs @@ -6,21 +6,61 @@ fn grid_auto_rows__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(-4i16), end: taffy::style::GridPlacement::Auto }, ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![length(100f32)], grid_auto_rows: vec![length(10f32), length(20f32), length(30f32)], @@ -397,36 +437,69 @@ fn grid_auto_rows__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(-4i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![length(100f32)], grid_auto_rows: vec![length(10f32), length(20f32), length(30f32)], diff --git a/tests/generated/grid/grid_auto_single_item.rs b/tests/generated/grid/grid_auto_single_item.rs index 21c9c8482..d621411ae 100644 --- a/tests/generated/grid/grid_auto_single_item.rs +++ b/tests/generated/grid/grid_auto_single_item.rs @@ -4,24 +4,69 @@ fn grid_auto_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), length(40f32)], ..Default::default() @@ -434,41 +479,78 @@ fn grid_auto_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), length(40f32)], ..Default::default() 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 fa619f4d6..12d40f10a 100644 --- a/tests/generated/grid/grid_auto_single_item_fixed_width.rs +++ b/tests/generated/grid/grid_auto_single_item_fixed_width.rs @@ -4,24 +4,69 @@ fn grid_auto_single_item_fixed_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, @@ -435,41 +480,78 @@ fn grid_auto_single_item_fixed_width__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, 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 0644ad5b0..8f65c0937 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 @@ -4,24 +4,69 @@ fn grid_auto_single_item_fixed_width_with_definite_width__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, @@ -435,41 +480,78 @@ fn grid_auto_single_item_fixed_width_with_definite_width__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), auto(), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, 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 a169755d8..592c5c96f 100644 --- a/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs +++ b/tests/generated/grid/grid_auto_takes_precedence_over_fr.rs @@ -4,12 +4,26 @@ fn grid_auto_takes_precedence_over_fr__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![auto(), fr(1f32)], size: taffy::geometry::Size { @@ -153,16 +167,28 @@ fn grid_auto_takes_precedence_over_fr__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![auto(), fr(1f32)], size: taffy::geometry::Size { 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 945a3e975..8dba8cdf0 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 @@ -6,13 +6,25 @@ fn grid_available_space_greater_than_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_available_space_greater_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, @@ -168,13 +184,27 @@ fn grid_available_space_greater_than_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -183,6 +213,10 @@ fn grid_available_space_greater_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, 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 c1fe7d454..777a5980c 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 @@ -6,13 +6,25 @@ fn grid_available_space_smaller_than_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_available_space_smaller_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, @@ -168,13 +184,27 @@ fn grid_available_space_smaller_than_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -183,6 +213,10 @@ fn grid_available_space_smaller_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, 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 cd9b24f32..da5fee2d7 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 @@ -6,13 +6,25 @@ fn grid_available_space_smaller_than_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_available_space_smaller_than_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, @@ -168,13 +184,27 @@ fn grid_available_space_smaller_than_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -183,6 +213,10 @@ fn grid_available_space_smaller_than_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], ..Default::default() }, diff --git a/tests/generated/grid/grid_basic.rs b/tests/generated/grid/grid_basic.rs index c4293f16a..6625516a8 100644 --- a/tests/generated/grid/grid_basic.rs +++ b/tests/generated/grid/grid_basic.rs @@ -4,19 +4,68 @@ fn grid_basic__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -433,37 +482,77 @@ fn grid_basic__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_basic_implicit_tracks.rs b/tests/generated/grid/grid_basic_implicit_tracks.rs index 8f09fa873..d27ef88ce 100644 --- a/tests/generated/grid/grid_basic_implicit_tracks.rs +++ b/tests/generated/grid/grid_basic_implicit_tracks.rs @@ -4,9 +4,15 @@ fn grid_basic_implicit_tracks__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(35f32), height: taffy::style::Dimension::from_length(35f32), @@ -18,6 +24,10 @@ fn grid_basic_implicit_tracks__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![length(40f32)], ..Default::default() @@ -157,11 +167,16 @@ fn grid_basic_implicit_tracks__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(35f32), height: taffy::style::Dimension::from_length(35f32), @@ -174,6 +189,10 @@ fn grid_basic_implicit_tracks__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![length(40f32)], ..Default::default() diff --git a/tests/generated/grid/grid_basic_with_overflow.rs b/tests/generated/grid/grid_basic_with_overflow.rs index 25abeacf3..4fa144598 100644 --- a/tests/generated/grid/grid_basic_with_overflow.rs +++ b/tests/generated/grid/grid_basic_with_overflow.rs @@ -4,20 +4,74 @@ fn grid_basic_with_overflow__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node9 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node9 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -473,40 +527,84 @@ fn grid_basic_with_overflow__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node9 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_basic_with_padding.rs b/tests/generated/grid/grid_basic_with_padding.rs index 75bd5f780..7a7721e73 100644 --- a/tests/generated/grid/grid_basic_with_padding.rs +++ b/tests/generated/grid/grid_basic_with_padding.rs @@ -4,19 +4,68 @@ fn grid_basic_with_padding__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -435,37 +484,77 @@ fn grid_basic_with_padding__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_display_none_fixed_size.rs b/tests/generated/grid/grid_display_none_fixed_size.rs index 8278238a4..17e2b8662 100644 --- a/tests/generated/grid/grid_display_none_fixed_size.rs +++ b/tests/generated/grid/grid_display_none_fixed_size.rs @@ -4,10 +4,17 @@ fn grid_display_none_fixed_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { flex_grow: 1f32, ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + flex_grow: 1f32, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -19,6 +26,10 @@ fn grid_display_none_fixed_size__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -168,6 +179,7 @@ fn grid_display_none_fixed_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, flex_grow: 1f32, ..Default::default() }) @@ -176,6 +188,7 @@ fn grid_display_none_fixed_size__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -188,6 +201,10 @@ fn grid_display_none_fixed_size__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 412dacdd8..f4866c1dc 100644 --- a/tests/generated/grid/grid_fit_content_percent_definite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_definite_argument.rs @@ -6,7 +6,13 @@ fn grid_fit_content_percent_definite_argument__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_definite_argument__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_fit_content_percent_definite_argument__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_fit_content_percent_definite_argument__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, 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 743d80efa..881d9a5dc 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 @@ -6,7 +6,13 @@ fn grid_fit_content_percent_definite_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_definite_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_fit_content_percent_definite_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_fit_content_percent_definite_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, 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 16dd305ee..2e9b51576 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 @@ -6,7 +6,13 @@ fn grid_fit_content_percent_definite_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_definite_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_fit_content_percent_definite_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_fit_content_percent_definite_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, 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 07252bc64..55d04114a 100644 --- a/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs +++ b/tests/generated/grid/grid_fit_content_percent_indefinite_argument.rs @@ -6,7 +6,13 @@ fn grid_fit_content_percent_indefinite_argument__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_indefinite_argument__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_percent_indefinite_argument__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_percent_indefinite_argument__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() 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 932222701..cc5f41ad3 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 @@ -6,7 +6,13 @@ fn grid_fit_content_percent_indefinite_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_indefinite_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_percent_indefinite_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_percent_indefinite_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() 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 00efa88d1..6d9908a68 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 @@ -21,6 +21,10 @@ fn grid_fit_content_percent_indefinite_max_content_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() @@ -139,6 +143,10 @@ fn grid_fit_content_percent_indefinite_max_content_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() 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 adf61a2ee..9e9940ecd 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 @@ -6,7 +6,13 @@ fn grid_fit_content_percent_indefinite_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_percent_indefinite_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_percent_indefinite_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_percent_indefinite_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() 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 0afc3db17..0d6c1ea93 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 @@ -21,6 +21,10 @@ fn grid_fit_content_percent_indefinite_min_content_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() @@ -139,6 +143,10 @@ fn grid_fit_content_percent_indefinite_min_content_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(percent(0.5f32))], ..Default::default() diff --git a/tests/generated/grid/grid_fit_content_points_argument.rs b/tests/generated/grid/grid_fit_content_points_argument.rs index 5a6020da2..846a83261 100644 --- a/tests/generated/grid/grid_fit_content_points_argument.rs +++ b/tests/generated/grid/grid_fit_content_points_argument.rs @@ -6,7 +6,13 @@ fn grid_fit_content_points_argument__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_points_argument__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_points_argument__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_points_argument__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() 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 0a4daea67..bba4646d8 100644 --- a/tests/generated/grid/grid_fit_content_points_max_content.rs +++ b/tests/generated/grid/grid_fit_content_points_max_content.rs @@ -6,7 +6,13 @@ fn grid_fit_content_points_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_points_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_points_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_points_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() 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 11de9ccee..468c2c0bb 100644 --- a/tests/generated/grid/grid_fit_content_points_min_content.rs +++ b/tests/generated/grid/grid_fit_content_points_min_content.rs @@ -6,7 +6,13 @@ fn grid_fit_content_points_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_fit_content_points_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_fit_content_points_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_fit_content_points_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() 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 ec4a4a4d6..52b72b216 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 @@ -21,6 +21,10 @@ fn grid_fit_content_points_min_content_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() @@ -139,6 +143,10 @@ fn grid_fit_content_points_min_content_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fit_content(length(30f32))], ..Default::default() 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 38bc0a430..ca8b6b5bc 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 @@ -4,13 +4,32 @@ fn grid_fr_fixed_size_no_content_proportions__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32), fr(3f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, @@ -190,19 +209,35 @@ fn grid_fr_fixed_size_no_content_proportions__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32), fr(3f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, 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 947dc6f73..950f1694d 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 @@ -4,12 +4,26 @@ fn grid_fr_fixed_size_no_content_proportions_sub_1_sum__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fr(0.3f32), fr(0.2f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -150,16 +164,28 @@ fn grid_fr_fixed_size_no_content_proportions_sub_1_sum__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![fr(0.3f32), fr(0.2f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, 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 61c4701cb..fc8a28ee5 100644 --- a/tests/generated/grid/grid_fr_fixed_size_single_item.rs +++ b/tests/generated/grid/grid_fr_fixed_size_single_item.rs @@ -4,24 +4,69 @@ fn grid_fr_fixed_size_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], size: taffy::geometry::Size { @@ -438,41 +483,78 @@ fn grid_fr_fixed_size_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], size: taffy::geometry::Size { 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 8a2d354fe..fd9e2573b 100644 --- a/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs +++ b/tests/generated/grid/grid_fr_no_sized_items_indefinite.rs @@ -4,19 +4,68 @@ fn grid_fr_no_sized_items_indefinite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], ..Default::default() @@ -429,37 +478,77 @@ fn grid_fr_no_sized_items_indefinite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], ..Default::default() diff --git a/tests/generated/grid/grid_fr_single_item_indefinite.rs b/tests/generated/grid/grid_fr_single_item_indefinite.rs index ea69361cf..2d55186af 100644 --- a/tests/generated/grid/grid_fr_single_item_indefinite.rs +++ b/tests/generated/grid/grid_fr_single_item_indefinite.rs @@ -4,24 +4,69 @@ fn grid_fr_single_item_indefinite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], size: taffy::geometry::Size { @@ -438,41 +483,78 @@ fn grid_fr_single_item_indefinite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), fr(1f32), fr(1f32)], grid_template_columns: vec![length(40f32), fr(1f32), fr(1f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_fr_span_2_proportion.rs b/tests/generated/grid/grid_fr_span_2_proportion.rs index 507d7e0e6..2593da807 100644 --- a/tests/generated/grid/grid_fr_span_2_proportion.rs +++ b/tests/generated/grid/grid_fr_span_2_proportion.rs @@ -6,6 +6,7 @@ fn grid_fr_span_2_proportion__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -14,12 +15,26 @@ fn grid_fr_span_2_proportion__border_box() { ..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(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32)], ..Default::default() @@ -200,6 +215,7 @@ fn grid_fr_span_2_proportion__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -209,16 +225,28 @@ fn grid_fr_span_2_proportion__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32)], ..Default::default() 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 83bba63a7..35acf5dff 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 @@ -6,6 +6,7 @@ fn grid_fr_span_2_proportion_sub_1_sum__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -14,12 +15,26 @@ fn grid_fr_span_2_proportion_sub_1_sum__border_box() { ..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(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0.2f32), fr(0.3f32)], ..Default::default() @@ -200,6 +215,7 @@ fn grid_fr_span_2_proportion_sub_1_sum__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -209,16 +225,28 @@ fn grid_fr_span_2_proportion_sub_1_sum__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0.2f32), fr(0.3f32)], ..Default::default() 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 0ae0f871f..93e4bca97 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 @@ -6,6 +6,7 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -14,14 +15,38 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32), fr(3f32)], ..Default::default() @@ -280,6 +305,7 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -289,22 +315,42 @@ fn grid_fr_span_2_proportion_with_non_spanned_track__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(1f32), fr(2f32), fr(3f32)], ..Default::default() 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 1b331bab7..8c69edd5e 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 @@ -6,6 +6,7 @@ fn grid_fr_span_2_proportion_zero_sum__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -14,12 +15,26 @@ fn grid_fr_span_2_proportion_zero_sum__border_box() { ..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(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0f32), fr(0f32)], ..Default::default() @@ -200,6 +215,7 @@ fn grid_fr_span_2_proportion_zero_sum__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -209,16 +225,28 @@ fn grid_fr_span_2_proportion_zero_sum__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0f32), fr(0f32)], ..Default::default() 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 20b17622b..273d9011e 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 @@ -6,6 +6,7 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -14,14 +15,38 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0f32), fr(0f32), fr(0f32)], ..Default::default() @@ -280,6 +305,7 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -289,22 +315,42 @@ fn grid_fr_span_2_proportion_zero_sum_with_non_spanned_track__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![fr(0f32), fr(0f32), fr(0f32)], ..Default::default() diff --git a/tests/generated/grid/grid_gap.rs b/tests/generated/grid/grid_gap.rs index 220a71924..fd3ec4d55 100644 --- a/tests/generated/grid/grid_gap.rs +++ b/tests/generated/grid/grid_gap.rs @@ -4,19 +4,68 @@ fn grid_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(40f32), height: length(40f32) }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(40f32), height: length(40f32) }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_hidden.rs b/tests/generated/grid/grid_hidden.rs index 1501f8383..3b94e2a2b 100644 --- a/tests/generated/grid/grid_hidden.rs +++ b/tests/generated/grid/grid_hidden.rs @@ -4,22 +4,71 @@ fn grid_hidden__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - 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(taffy::style::Style { display: taffy::style::Display::None, ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = - taffy.new_leaf(taffy::style::Style { display: taffy::style::Display::None, ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + display: taffy::style::Display::None, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -436,49 +485,80 @@ fn grid_hidden__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::None, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, ..Default::default() }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_inflow_overflow_clip.rs b/tests/generated/grid/grid_inflow_overflow_clip.rs index 7d2c1daf1..ce71433b6 100644 --- a/tests/generated/grid/grid_inflow_overflow_clip.rs +++ b/tests/generated/grid/grid_inflow_overflow_clip.rs @@ -7,6 +7,10 @@ fn grid_inflow_overflow_clip__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -21,7 +25,6 @@ fn grid_inflow_overflow_clip__border_box() { taffy::style::Style { display: taffy::style::Display::Grid, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -145,6 +148,10 @@ fn grid_inflow_overflow_clip__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -160,7 +167,6 @@ fn grid_inflow_overflow_clip__content_box() { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_inflow_overflow_hidden.rs b/tests/generated/grid/grid_inflow_overflow_hidden.rs index eba5bdc84..a69adbb8b 100644 --- a/tests/generated/grid/grid_inflow_overflow_hidden.rs +++ b/tests/generated/grid/grid_inflow_overflow_hidden.rs @@ -7,6 +7,10 @@ fn grid_inflow_overflow_hidden__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -148,6 +152,10 @@ fn grid_inflow_overflow_hidden__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_inflow_overflow_scroll.rs b/tests/generated/grid/grid_inflow_overflow_scroll.rs index 4ffb4fb88..3370cb6fa 100644 --- a/tests/generated/grid/grid_inflow_overflow_scroll.rs +++ b/tests/generated/grid/grid_inflow_overflow_scroll.rs @@ -7,6 +7,10 @@ fn grid_inflow_overflow_scroll__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -148,6 +152,10 @@ fn grid_inflow_overflow_scroll__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_inflow_overflow_visible.rs b/tests/generated/grid/grid_inflow_overflow_visible.rs index 8db82497c..d608d1953 100644 --- a/tests/generated/grid/grid_inflow_overflow_visible.rs +++ b/tests/generated/grid/grid_inflow_overflow_visible.rs @@ -7,6 +7,10 @@ fn grid_inflow_overflow_visible__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -20,6 +24,10 @@ fn grid_inflow_overflow_visible__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -143,6 +151,10 @@ fn grid_inflow_overflow_visible__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -157,6 +169,10 @@ fn grid_inflow_overflow_visible__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_justify_content_center.rs b/tests/generated/grid/grid_justify_content_center.rs index a4dd4d61d..52b07046e 100644 --- a/tests/generated/grid/grid_justify_content_center.rs +++ b/tests/generated/grid/grid_justify_content_center.rs @@ -4,19 +4,68 @@ fn grid_justify_content_center__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_center__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 e3ece1d6d..9b9c30e8e 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 @@ -4,19 +4,68 @@ fn grid_justify_content_center_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_center_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_center_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Center), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_center_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 b7fdd1062..30a26bf44 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 @@ -4,19 +4,68 @@ fn grid_justify_content_center_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_center_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_content_end.rs b/tests/generated/grid/grid_justify_content_end.rs index b7311ece3..a02e4c362 100644 --- a/tests/generated/grid/grid_justify_content_end.rs +++ b/tests/generated/grid/grid_justify_content_end.rs @@ -4,19 +4,68 @@ fn grid_justify_content_end__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_end__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 cbdc45bd9..e66ef370b 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 @@ -4,19 +4,68 @@ fn grid_justify_content_end_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::End), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_end_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_end_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::End), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_end_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 7509fce51..edf285539 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 @@ -4,19 +4,68 @@ fn grid_justify_content_end_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_end_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_content_space_around.rs b/tests/generated/grid/grid_justify_content_space_around.rs index 6c01a9e64..ca4540953 100644 --- a/tests/generated/grid/grid_justify_content_space_around.rs +++ b/tests/generated/grid/grid_justify_content_space_around.rs @@ -4,19 +4,68 @@ fn grid_justify_content_space_around__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_space_around__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 47739029c..480176ce6 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_around_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_space_around_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_space_around_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceAround), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_space_around_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 57260263c..89f7fd734 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_around_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_space_around_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceAround), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_content_space_between.rs b/tests/generated/grid/grid_justify_content_space_between.rs index 0d3e15541..353974a96 100644 --- a/tests/generated/grid/grid_justify_content_space_between.rs +++ b/tests/generated/grid/grid_justify_content_space_between.rs @@ -4,19 +4,68 @@ fn grid_justify_content_space_between__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_space_between__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 ca0daf34f..e23a8fd5a 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_between_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_space_between_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_space_between_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceBetween), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_space_between_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 6e280214f..4e5e89f66 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_between_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_space_between_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceBetween), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_content_space_evenly.rs b/tests/generated/grid/grid_justify_content_space_evenly.rs index 6068c8edd..b0aae3a92 100644 --- a/tests/generated/grid/grid_justify_content_space_evenly.rs +++ b/tests/generated/grid/grid_justify_content_space_evenly.rs @@ -4,19 +4,68 @@ fn grid_justify_content_space_evenly__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_space_evenly__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 e344556c6..289f27159 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_evenly_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_space_evenly_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_space_evenly_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_space_evenly_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 c55f1ff27..3f15dd227 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 @@ -4,19 +4,68 @@ fn grid_justify_content_space_evenly_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_space_evenly_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::SpaceEvenly), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_content_start.rs b/tests/generated/grid/grid_justify_content_start.rs index bc4e9e719..608a2edff 100644 --- a/tests/generated/grid/grid_justify_content_start.rs +++ b/tests/generated/grid/grid_justify_content_start.rs @@ -4,19 +4,68 @@ fn grid_justify_content_start__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -434,37 +483,77 @@ fn grid_justify_content_start__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], 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 4d18151a4..19f508fb4 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 @@ -4,19 +4,68 @@ fn grid_justify_content_start_negative_space_gap__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node04 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node05 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node06 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node07 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node08 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node04 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node05 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node06 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node07 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node08 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Start), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -35,6 +84,10 @@ fn grid_justify_content_start_negative_space_gap__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), @@ -554,37 +607,77 @@ fn grid_justify_content_start_negative_space_gap__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node04 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node05 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node06 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node07 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node08 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_content: Some(taffy::style::AlignContent::Center), justify_content: Some(taffy::style::JustifyContent::Start), gap: taffy::geometry::Size { width: length(10f32), height: length(10f32) }, @@ -604,6 +697,10 @@ fn grid_justify_content_start_negative_space_gap__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(240f32), height: taffy::style::Dimension::from_length(240f32), 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 0f0dc59c1..de6fae25f 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 @@ -4,19 +4,68 @@ fn grid_justify_content_start_with_padding_border__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -446,37 +495,77 @@ fn grid_justify_content_start_with_padding_border__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_items_sized_center.rs b/tests/generated/grid/grid_justify_items_sized_center.rs index 0b640d2ac..704e15e74 100644 --- a/tests/generated/grid/grid_justify_items_sized_center.rs +++ b/tests/generated/grid/grid_justify_items_sized_center.rs @@ -6,6 +6,7 @@ fn grid_justify_items_sized_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_justify_items_sized_center__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_justify_items_sized_center__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_justify_items_sized_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_justify_items_sized_center__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_justify_items_sized_center__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Center), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_items_sized_end.rs b/tests/generated/grid/grid_justify_items_sized_end.rs index 0cfa7bd05..16a994ccb 100644 --- a/tests/generated/grid/grid_justify_items_sized_end.rs +++ b/tests/generated/grid/grid_justify_items_sized_end.rs @@ -6,6 +6,7 @@ fn grid_justify_items_sized_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_justify_items_sized_end__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_justify_items_sized_end__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_justify_items_sized_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_justify_items_sized_end__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_justify_items_sized_end__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::End), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_items_sized_start.rs b/tests/generated/grid/grid_justify_items_sized_start.rs index 3d70fd77a..480bde3fe 100644 --- a/tests/generated/grid/grid_justify_items_sized_start.rs +++ b/tests/generated/grid/grid_justify_items_sized_start.rs @@ -6,6 +6,7 @@ fn grid_justify_items_sized_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_justify_items_sized_start__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_justify_items_sized_start__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_justify_items_sized_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_justify_items_sized_start__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_justify_items_sized_start__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Start), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_items_sized_stretch.rs b/tests/generated/grid/grid_justify_items_sized_stretch.rs index 3ad2494eb..60615c95c 100644 --- a/tests/generated/grid/grid_justify_items_sized_stretch.rs +++ b/tests/generated/grid/grid_justify_items_sized_stretch.rs @@ -6,6 +6,7 @@ fn grid_justify_items_sized_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_justify_items_sized_stretch__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -30,6 +32,10 @@ fn grid_justify_items_sized_stretch__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Stretch), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], @@ -176,6 +182,7 @@ fn grid_justify_items_sized_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -188,6 +195,7 @@ fn grid_justify_items_sized_stretch__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -202,6 +210,10 @@ fn grid_justify_items_sized_stretch__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Stretch), grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], diff --git a/tests/generated/grid/grid_justify_self_sized_all.rs b/tests/generated/grid/grid_justify_self_sized_all.rs index 6e74512ed..e1afc8237 100644 --- a/tests/generated/grid/grid_justify_self_sized_all.rs +++ b/tests/generated/grid/grid_justify_self_sized_all.rs @@ -6,6 +6,7 @@ fn grid_justify_self_sized_all__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -16,6 +17,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -26,6 +28,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -36,6 +39,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -46,6 +50,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -56,6 +61,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -66,6 +72,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -76,6 +83,7 @@ fn grid_justify_self_sized_all__border_box() { .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -88,6 +96,10 @@ fn grid_justify_self_sized_all__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -467,6 +479,7 @@ fn grid_justify_self_sized_all__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -478,6 +491,7 @@ fn grid_justify_self_sized_all__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -489,6 +503,7 @@ fn grid_justify_self_sized_all__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -500,6 +515,7 @@ fn grid_justify_self_sized_all__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -511,6 +527,7 @@ fn grid_justify_self_sized_all__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -522,6 +539,7 @@ fn grid_justify_self_sized_all__content_box() { let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -533,6 +551,7 @@ fn grid_justify_self_sized_all__content_box() { let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), @@ -544,6 +563,7 @@ fn grid_justify_self_sized_all__content_box() { let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), @@ -557,6 +577,10 @@ fn grid_justify_self_sized_all__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_margins_auto_margins.rs b/tests/generated/grid/grid_margins_auto_margins.rs index c581cac35..1bd1a1aac 100644 --- a/tests/generated/grid/grid_margins_auto_margins.rs +++ b/tests/generated/grid/grid_margins_auto_margins.rs @@ -4,10 +4,21 @@ fn grid_margins_auto_margins__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, margin: taffy::geometry::Rect { @@ -19,9 +30,15 @@ fn grid_margins_auto_margins__border_box() { ..Default::default() }) .unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, margin: taffy::geometry::Rect { @@ -33,9 +50,15 @@ fn grid_margins_auto_margins__border_box() { ..Default::default() }) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -51,12 +74,26 @@ fn grid_margins_auto_margins__border_box() { ..Default::default() }) .unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -475,14 +512,23 @@ fn grid_margins_auto_margins__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, margin: taffy::geometry::Rect { @@ -495,11 +541,16 @@ fn grid_margins_auto_margins__content_box() { }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), size: taffy::geometry::Size { width: auto(), height: taffy::style::Dimension::from_length(20f32) }, margin: taffy::geometry::Rect { @@ -512,11 +563,16 @@ fn grid_margins_auto_margins__content_box() { }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -533,16 +589,28 @@ fn grid_margins_auto_margins__content_box() { }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { 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 151900d37..94db43591 100644 --- a/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs +++ b/tests/generated/grid/grid_margins_auto_margins_override_stretch.rs @@ -4,15 +4,49 @@ fn grid_margins_auto_margins_override_stretch__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node6 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), margin: taffy::geometry::Rect { @@ -26,12 +60,26 @@ fn grid_margins_auto_margins_override_stretch__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -450,27 +498,55 @@ fn grid_margins_auto_margins_override_stretch__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), margin: taffy::geometry::Rect { @@ -485,16 +561,28 @@ fn grid_margins_auto_margins_override_stretch__content_box() { ) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_margins_fixed_center.rs b/tests/generated/grid/grid_margins_fixed_center.rs index 7660c12b7..5215296d6 100644 --- a/tests/generated/grid/grid_margins_fixed_center.rs +++ b/tests/generated/grid/grid_margins_fixed_center.rs @@ -6,6 +6,7 @@ fn grid_margins_fixed_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_fixed_center__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -333,6 +363,7 @@ fn grid_margins_fixed_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { @@ -349,25 +380,49 @@ fn grid_margins_fixed_center__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_margins_fixed_end.rs b/tests/generated/grid/grid_margins_fixed_end.rs index 395adf15c..d80dd8f23 100644 --- a/tests/generated/grid/grid_margins_fixed_end.rs +++ b/tests/generated/grid/grid_margins_fixed_end.rs @@ -6,6 +6,7 @@ fn grid_margins_fixed_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_fixed_end__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -333,6 +363,7 @@ fn grid_margins_fixed_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -349,25 +380,49 @@ fn grid_margins_fixed_end__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_margins_fixed_start.rs b/tests/generated/grid/grid_margins_fixed_start.rs index c0d09cf64..d8d72fd18 100644 --- a/tests/generated/grid/grid_margins_fixed_start.rs +++ b/tests/generated/grid/grid_margins_fixed_start.rs @@ -6,6 +6,7 @@ fn grid_margins_fixed_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_fixed_start__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -333,6 +363,7 @@ fn grid_margins_fixed_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -349,25 +380,49 @@ fn grid_margins_fixed_start__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_margins_fixed_stretch.rs b/tests/generated/grid/grid_margins_fixed_stretch.rs index 17144eb9e..16f3f29f3 100644 --- a/tests/generated/grid/grid_margins_fixed_stretch.rs +++ b/tests/generated/grid/grid_margins_fixed_stretch.rs @@ -6,6 +6,7 @@ fn grid_margins_fixed_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_fixed_stretch__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { @@ -333,6 +363,7 @@ fn grid_margins_fixed_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { @@ -349,25 +380,49 @@ fn grid_margins_fixed_stretch__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], padding: taffy::geometry::Rect { diff --git a/tests/generated/grid/grid_margins_percent_center.rs b/tests/generated/grid/grid_margins_percent_center.rs index e231b5b06..b5060e2fa 100644 --- a/tests/generated/grid/grid_margins_percent_center.rs +++ b/tests/generated/grid/grid_margins_percent_center.rs @@ -6,6 +6,7 @@ fn grid_margins_percent_center__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_percent_center__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() @@ -327,6 +357,7 @@ fn grid_margins_percent_center__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Center), justify_self: Some(taffy::style::JustifySelf::Center), size: taffy::geometry::Size { @@ -343,25 +374,49 @@ fn grid_margins_percent_center__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() diff --git a/tests/generated/grid/grid_margins_percent_end.rs b/tests/generated/grid/grid_margins_percent_end.rs index 7f4836d13..d401acf08 100644 --- a/tests/generated/grid/grid_margins_percent_end.rs +++ b/tests/generated/grid/grid_margins_percent_end.rs @@ -6,6 +6,7 @@ fn grid_margins_percent_end__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_percent_end__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() @@ -327,6 +357,7 @@ fn grid_margins_percent_end__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::End), justify_self: Some(taffy::style::JustifySelf::End), size: taffy::geometry::Size { @@ -343,25 +374,49 @@ fn grid_margins_percent_end__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() diff --git a/tests/generated/grid/grid_margins_percent_start.rs b/tests/generated/grid/grid_margins_percent_start.rs index 7362d12a2..771e5855f 100644 --- a/tests/generated/grid/grid_margins_percent_start.rs +++ b/tests/generated/grid/grid_margins_percent_start.rs @@ -6,6 +6,7 @@ fn grid_margins_percent_start__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_percent_start__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() @@ -327,6 +357,7 @@ fn grid_margins_percent_start__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { @@ -343,25 +374,49 @@ fn grid_margins_percent_start__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() diff --git a/tests/generated/grid/grid_margins_percent_stretch.rs b/tests/generated/grid/grid_margins_percent_stretch.rs index 4236e6dd7..aa143ad6c 100644 --- a/tests/generated/grid/grid_margins_percent_stretch.rs +++ b/tests/generated/grid/grid_margins_percent_stretch.rs @@ -6,6 +6,7 @@ fn grid_margins_percent_stretch__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { @@ -21,15 +22,44 @@ fn grid_margins_percent_stretch__border_box() { ..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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() @@ -327,6 +357,7 @@ fn grid_margins_percent_stretch__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, align_self: Some(taffy::style::AlignSelf::Stretch), justify_self: Some(taffy::style::JustifySelf::Stretch), size: taffy::geometry::Size { @@ -343,25 +374,49 @@ fn grid_margins_percent_stretch__content_box() { }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(20f32), length(20f32), length(20f32)], ..Default::default() 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 6840d08b1..0b8a96057 100644 --- a/tests/generated/grid/grid_max_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_max_content_maximum_single_item.rs @@ -4,24 +4,74 @@ fn grid_max_content_maximum_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(0f32), max_content()), length(40f32)], ..Default::default() @@ -434,40 +484,83 @@ fn grid_max_content_maximum_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(0f32), max_content()), length(40f32)], ..Default::default() diff --git a/tests/generated/grid/grid_max_content_single_item.rs b/tests/generated/grid/grid_max_content_single_item.rs index 388185111..ea92ff7e7 100644 --- a/tests/generated/grid/grid_max_content_single_item.rs +++ b/tests/generated/grid/grid_max_content_single_item.rs @@ -4,24 +4,74 @@ fn grid_max_content_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() @@ -434,40 +484,83 @@ fn grid_max_content_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() 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 c03689373..7204b2cd8 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_margin_auto__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: taffy::style::LengthPercentageAuto::AUTO, @@ -19,17 +28,56 @@ fn grid_max_content_single_item_margin_auto__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() @@ -442,12 +490,20 @@ fn grid_max_content_single_item_margin_auto__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, right: taffy::style::LengthPercentageAuto::AUTO, @@ -460,31 +516,63 @@ fn grid_max_content_single_item_margin_auto__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() 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 9829d5f52..7076f1251 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_margin_fixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: length(20f32), right: length(10f32), @@ -19,17 +28,56 @@ fn grid_max_content_single_item_margin_fixed__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() @@ -442,12 +490,20 @@ fn grid_max_content_single_item_margin_fixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: length(20f32), right: length(10f32), @@ -460,31 +516,63 @@ fn grid_max_content_single_item_margin_fixed__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() 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 8477a756b..9863e95ec 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_margin_percent__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: percent(0.2f32), right: percent(0.1f32), @@ -19,17 +28,56 @@ fn grid_max_content_single_item_margin_percent__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() @@ -442,12 +490,20 @@ fn grid_max_content_single_item_margin_percent__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, margin: taffy::geometry::Rect { left: percent(0.2f32), right: percent(0.1f32), @@ -460,31 +516,63 @@ fn grid_max_content_single_item_margin_percent__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), length(40f32)], ..Default::default() 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 4b1c771c7..849b3d5e4 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_span_2__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -17,17 +26,56 @@ fn grid_max_content_single_item_span_2__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], ..Default::default() @@ -440,12 +488,20 @@ fn grid_max_content_single_item_span_2__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -456,31 +512,63 @@ fn grid_max_content_single_item_span_2__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], ..Default::default() 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 c71e224d0..ca7904508 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_span_2_gap_fixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -17,17 +26,56 @@ fn grid_max_content_single_item_span_2_gap_fixed__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(20f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], @@ -441,12 +489,20 @@ fn grid_max_content_single_item_span_2_gap_fixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -457,31 +513,63 @@ fn grid_max_content_single_item_span_2_gap_fixed__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: length(20f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], 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 8fc8e8f8b..d6343ae7d 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -17,17 +26,56 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], @@ -442,12 +490,20 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -458,31 +514,63 @@ fn grid_max_content_single_item_span_2_gap_percent_definite__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], 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 5536d0a2c..2f7f9616c 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 @@ -4,10 +4,19 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -17,17 +26,56 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], @@ -441,12 +489,20 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -457,31 +513,63 @@ fn grid_max_content_single_item_span_2_gap_percent_indefinite__content_box() { ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, gap: taffy::geometry::Size { width: percent(0.2f32), height: zero() }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), max_content(), max_content()], 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 073cb7814..99e3a2858 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 @@ -6,13 +6,25 @@ fn grid_max_width_greater_than_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_max_width_greater_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, ..Default::default() @@ -31,6 +47,10 @@ fn grid_max_width_greater_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, @@ -221,13 +241,27 @@ fn grid_max_width_greater_than_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -236,6 +270,10 @@ fn grid_max_width_greater_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(400f32), height: auto() }, ..Default::default() @@ -248,6 +286,10 @@ fn grid_max_width_greater_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, 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 b273d5620..c2b3228a0 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 @@ -6,13 +6,25 @@ fn grid_max_width_less_than_max_content_with_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_max_width_less_than_max_content_with_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -31,6 +47,10 @@ fn grid_max_width_less_than_max_content_with_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, @@ -221,13 +241,27 @@ fn grid_max_width_less_than_max_content_with_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -236,6 +270,10 @@ fn grid_max_width_less_than_max_content_with_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -248,6 +286,10 @@ fn grid_max_width_less_than_max_content_with_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![min_content()], ..Default::default() }, 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 61a674e2a..8f0f374e1 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 @@ -6,13 +6,25 @@ fn grid_max_width_smaller_than_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_max_width_smaller_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -31,6 +47,10 @@ fn grid_max_width_smaller_than_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, @@ -221,13 +241,27 @@ fn grid_max_width_smaller_than_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -236,6 +270,10 @@ fn grid_max_width_smaller_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(80f32), height: auto() }, ..Default::default() @@ -248,6 +286,10 @@ fn grid_max_width_smaller_than_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, 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 6a0d0319d..ae631a53e 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 @@ -6,13 +6,25 @@ fn grid_max_width_smaller_than_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -20,6 +32,10 @@ fn grid_max_width_smaller_than_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -31,6 +47,10 @@ fn grid_max_width_smaller_than_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, @@ -221,13 +241,27 @@ fn grid_max_width_smaller_than_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHH\u{200b}HHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -236,6 +270,10 @@ fn grid_max_width_smaller_than_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![auto(), auto()], max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, ..Default::default() @@ -248,6 +286,10 @@ fn grid_max_width_smaller_than_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![max_content()], ..Default::default() }, diff --git a/tests/generated/grid/grid_min_content_flex_column.rs b/tests/generated/grid/grid_min_content_flex_column.rs index 4cc2ed638..6f82705c8 100644 --- a/tests/generated/grid/grid_min_content_flex_column.rs +++ b/tests/generated/grid/grid_min_content_flex_column.rs @@ -6,19 +6,37 @@ fn grid_min_content_flex_column__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -27,6 +45,10 @@ fn grid_min_content_flex_column__border_box() { taffy::style::Style { display: taffy::style::Display::Flex, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01, node02], @@ -36,6 +58,10 @@ fn grid_min_content_flex_column__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() @@ -272,19 +298,40 @@ fn grid_min_content_flex_column__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -294,6 +341,10 @@ fn grid_min_content_flex_column__content_box() { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01, node02], @@ -304,6 +355,10 @@ fn grid_min_content_flex_column__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() diff --git a/tests/generated/grid/grid_min_content_flex_row.rs b/tests/generated/grid/grid_min_content_flex_row.rs index 267e658d6..8fe6d2cce 100644 --- a/tests/generated/grid/grid_min_content_flex_row.rs +++ b/tests/generated/grid/grid_min_content_flex_row.rs @@ -6,25 +6,50 @@ fn grid_min_content_flex_row__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Flex, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Flex, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00, node01, node02], ) .unwrap(); @@ -32,6 +57,10 @@ fn grid_min_content_flex_row__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() @@ -268,19 +297,40 @@ fn grid_min_content_flex_row__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -289,6 +339,10 @@ fn grid_min_content_flex_row__content_box() { taffy::style::Style { display: taffy::style::Display::Flex, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00, node01, node02], @@ -299,6 +353,10 @@ fn grid_min_content_flex_row__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() 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 cb7a39397..86fdc3a01 100644 --- a/tests/generated/grid/grid_min_content_flex_single_item.rs +++ b/tests/generated/grid/grid_min_content_flex_single_item.rs @@ -4,18 +4,38 @@ fn grid_min_content_flex_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); - let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -25,13 +45,32 @@ fn grid_min_content_flex_single_item__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() @@ -405,25 +444,42 @@ fn grid_min_content_flex_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -434,19 +490,35 @@ fn grid_min_content_flex_single_item__content_box() { ) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() 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 ed7477208..ed06b229a 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 @@ -4,9 +4,15 @@ fn grid_min_content_flex_single_item_margin_auto__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, @@ -17,11 +23,25 @@ fn grid_min_content_flex_single_item_margin_auto__border_box() { ..Default::default() }) .unwrap(); - let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -37,13 +57,32 @@ fn grid_min_content_flex_single_item_margin_auto__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() @@ -417,11 +456,16 @@ fn grid_min_content_flex_single_item_margin_auto__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: taffy::style::LengthPercentageAuto::AUTO, @@ -433,15 +477,27 @@ fn grid_min_content_flex_single_item_margin_auto__content_box() { }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -458,19 +514,35 @@ fn grid_min_content_flex_single_item_margin_auto__content_box() { ) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() 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 4b49612fa..516987956 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 @@ -4,9 +4,15 @@ fn grid_min_content_flex_single_item_margin_fixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: length(20f32), @@ -17,11 +23,25 @@ fn grid_min_content_flex_single_item_margin_fixed__border_box() { ..Default::default() }) .unwrap(); - let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -37,13 +57,32 @@ fn grid_min_content_flex_single_item_margin_fixed__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() @@ -417,11 +456,16 @@ fn grid_min_content_flex_single_item_margin_fixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: length(20f32), @@ -433,15 +477,27 @@ fn grid_min_content_flex_single_item_margin_fixed__content_box() { }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -458,19 +514,35 @@ fn grid_min_content_flex_single_item_margin_fixed__content_box() { ) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() 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 c7640452f..e0b7bdd74 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 @@ -4,9 +4,15 @@ fn grid_min_content_flex_single_item_margin_percent__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -17,11 +23,25 @@ fn grid_min_content_flex_single_item_margin_percent__border_box() { ..Default::default() }) .unwrap(); - let node2 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -37,13 +57,32 @@ fn grid_min_content_flex_single_item_margin_percent__border_box() { crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() @@ -417,11 +456,16 @@ fn grid_min_content_flex_single_item_margin_percent__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.2f32), @@ -433,15 +477,27 @@ fn grid_min_content_flex_single_item_margin_percent__content_box() { }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: taffy::style::GridPlacement::Span(2u16), end: taffy::style::GridPlacement::Auto, @@ -458,19 +514,35 @@ fn grid_min_content_flex_single_item_margin_percent__content_box() { ) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), fr(1f32)], ..Default::default() 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 af1690d36..83385d1e2 100644 --- a/tests/generated/grid/grid_min_content_maximum_single_item.rs +++ b/tests/generated/grid/grid_min_content_maximum_single_item.rs @@ -4,24 +4,74 @@ fn grid_min_content_maximum_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(0f32), min_content()), length(40f32)], ..Default::default() @@ -434,40 +484,83 @@ fn grid_min_content_maximum_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(0f32), min_content()), length(40f32)], ..Default::default() diff --git a/tests/generated/grid/grid_min_content_single_item.rs b/tests/generated/grid/grid_min_content_single_item.rs index 3dfcec598..62a75d454 100644 --- a/tests/generated/grid/grid_min_content_single_item.rs +++ b/tests/generated/grid/grid_min_content_single_item.rs @@ -4,24 +4,74 @@ fn grid_min_content_single_item__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), length(40f32)], ..Default::default() @@ -434,40 +484,83 @@ fn grid_min_content_single_item__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), min_content(), length(40f32)], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs index 08b626ca1..48d4c98e9 100644 --- a/tests/generated/grid/grid_minmax_auto_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_auto_fixed_10px.rs @@ -6,7 +6,13 @@ fn grid_minmax_auto_fixed_10px__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_auto_fixed_10px__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), length(10f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_auto_fixed_10px__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_auto_fixed_10px__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), length(10f32))], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_auto_max_content.rs b/tests/generated/grid/grid_minmax_auto_max_content.rs index 89684b4f6..3a6ad8533 100644 --- a/tests/generated/grid/grid_minmax_auto_max_content.rs +++ b/tests/generated/grid/grid_minmax_auto_max_content.rs @@ -6,7 +6,13 @@ fn grid_minmax_auto_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_auto_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), max_content())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_auto_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_auto_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), max_content())], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_auto_min_content.rs b/tests/generated/grid/grid_minmax_auto_min_content.rs index ce61654cb..a931df8ca 100644 --- a/tests/generated/grid/grid_minmax_auto_min_content.rs +++ b/tests/generated/grid/grid_minmax_auto_min_content.rs @@ -6,7 +6,13 @@ fn grid_minmax_auto_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_auto_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), min_content())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_auto_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_auto_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), min_content())], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_auto_percent_definite.rs b/tests/generated/grid/grid_minmax_auto_percent_definite.rs index 07c511e45..eb970cf18 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_definite.rs @@ -6,7 +6,13 @@ fn grid_minmax_auto_percent_definite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_auto_percent_definite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_minmax_auto_percent_definite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_minmax_auto_percent_definite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, diff --git a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs index da8fefb1b..64ff629a2 100644 --- a/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_auto_percent_indefinite.rs @@ -6,7 +6,13 @@ fn grid_minmax_auto_percent_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_auto_percent_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), percent(0.2f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_auto_percent_indefinite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_auto_percent_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(auto(), percent(0.2f32))], ..Default::default() 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 607af4fac..0aca43dec 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 @@ -4,19 +4,68 @@ fn grid_minmax_column_fixed_width_above_range__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(140f32), height: auto() }, @@ -430,37 +479,77 @@ fn grid_minmax_column_fixed_width_above_range__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(140f32), height: auto() }, 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 a373c305d..5219cd24b 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 @@ -4,19 +4,68 @@ fn grid_minmax_column_fixed_width_below_range__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(90f32), height: auto() }, @@ -430,37 +479,77 @@ fn grid_minmax_column_fixed_width_below_range__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(90f32), height: auto() }, 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 6a312805e..782d05363 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 @@ -4,19 +4,68 @@ fn grid_minmax_column_fixed_width_within_range__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), height: auto() }, @@ -430,37 +479,77 @@ fn grid_minmax_column_fixed_width_within_range__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(110f32), height: auto() }, diff --git a/tests/generated/grid/grid_minmax_column_indefinite.rs b/tests/generated/grid/grid_minmax_column_indefinite.rs index c36bc6683..b1861ee8a 100644 --- a/tests/generated/grid/grid_minmax_column_indefinite.rs +++ b/tests/generated/grid/grid_minmax_column_indefinite.rs @@ -4,19 +4,68 @@ fn grid_minmax_column_indefinite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], ..Default::default() @@ -429,37 +478,77 @@ fn grid_minmax_column_indefinite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), minmax(length(20f32), length(40f32)), length(40f32)], ..Default::default() 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 22f6bb8de..f73109f82 100644 --- a/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_auto_fixed.rs @@ -4,12 +4,26 @@ fn grid_minmax_column_with_auto_fixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(length(20f32), length(40f32)), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, @@ -150,16 +164,28 @@ fn grid_minmax_column_with_auto_fixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(length(20f32), length(40f32)), auto()], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, 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 f5d8d1308..326614c6c 100644 --- a/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs +++ b/tests/generated/grid/grid_minmax_column_with_fr_fixed.rs @@ -4,12 +4,26 @@ fn grid_minmax_column_with_fr_fixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(length(20f32), length(40f32)), fr(1f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, @@ -150,16 +164,28 @@ fn grid_minmax_column_with_fr_fixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(length(20f32), length(40f32)), fr(1f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(60f32), height: auto() }, diff --git a/tests/generated/grid/grid_minmax_max_content_1fr.rs b/tests/generated/grid/grid_minmax_max_content_1fr.rs index a03a3602c..3dd5e089c 100644 --- a/tests/generated/grid/grid_minmax_max_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_max_content_1fr.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_1fr__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_1fr__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), fr(1f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_max_content_1fr__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_max_content_1fr__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), fr(1f32))], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_max_content_auto.rs b/tests/generated/grid/grid_minmax_max_content_auto.rs index 329447793..8522b1a28 100644 --- a/tests/generated/grid/grid_minmax_max_content_auto.rs +++ b/tests/generated/grid/grid_minmax_max_content_auto.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_auto__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_auto__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), auto())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_max_content_auto__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_max_content_auto__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), auto())], ..Default::default() 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 cb38c94c8..dd20a9969 100644 --- a/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_max_content_fixed_10px.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_fixed_10px__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_fixed_10px__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), length(10f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_max_content_fixed_10px__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_max_content_fixed_10px__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), length(10f32))], ..Default::default() 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 f965b7856..10b0927ac 100644 --- a/tests/generated/grid/grid_minmax_max_content_min_content.rs +++ b/tests/generated/grid/grid_minmax_max_content_min_content.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_min_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_min_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), min_content())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_max_content_min_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_max_content_min_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), min_content())], ..Default::default() 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 4d52b6142..fc626e094 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_definite.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_percent_definite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_percent_definite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_minmax_max_content_percent_definite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_minmax_max_content_percent_definite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, 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 bba5abd25..937ed1dbd 100644 --- a/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_max_content_percent_indefinite.rs @@ -6,7 +6,13 @@ fn grid_minmax_max_content_percent_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_max_content_percent_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), percent(0.2f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_max_content_percent_indefinite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_max_content_percent_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(max_content(), percent(0.2f32))], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_min_content_1fr.rs b/tests/generated/grid/grid_minmax_min_content_1fr.rs index 3554c70f5..b0e67857a 100644 --- a/tests/generated/grid/grid_minmax_min_content_1fr.rs +++ b/tests/generated/grid/grid_minmax_min_content_1fr.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_1fr__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_1fr__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), fr(1f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_min_content_1fr__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_min_content_1fr__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), fr(1f32))], ..Default::default() diff --git a/tests/generated/grid/grid_minmax_min_content_auto.rs b/tests/generated/grid/grid_minmax_min_content_auto.rs index 21d5e36fd..8982c3c2a 100644 --- a/tests/generated/grid/grid_minmax_min_content_auto.rs +++ b/tests/generated/grid/grid_minmax_min_content_auto.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_auto__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_auto__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), auto())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_min_content_auto__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_min_content_auto__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), auto())], ..Default::default() 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 2e2f605d6..6af7e40ad 100644 --- a/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs +++ b/tests/generated/grid/grid_minmax_min_content_fixed_10px.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_fixed_10px__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_fixed_10px__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), length(10f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_min_content_fixed_10px__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_min_content_fixed_10px__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), length(10f32))], ..Default::default() 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 83f3827db..ff4b15cff 100644 --- a/tests/generated/grid/grid_minmax_min_content_max_content.rs +++ b/tests/generated/grid/grid_minmax_min_content_max_content.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_max_content__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_max_content__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), max_content())], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_min_content_max_content__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_min_content_max_content__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), max_content())], ..Default::default() 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 b6c805d7a..43f8fbb4c 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_definite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_definite.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_percent_definite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_percent_definite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, @@ -116,7 +126,14 @@ fn grid_minmax_min_content_percent_definite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -125,6 +142,10 @@ fn grid_minmax_min_content_percent_definite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), percent(0.2f32))], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: auto() }, 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 efe523513..0bbc5b322 100644 --- a/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs +++ b/tests/generated/grid/grid_minmax_min_content_percent_indefinite.rs @@ -6,7 +6,13 @@ fn grid_minmax_min_content_percent_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_minmax_min_content_percent_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), percent(0.2f32))], ..Default::default() @@ -115,7 +125,14 @@ fn grid_minmax_min_content_percent_indefinite__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -124,6 +141,10 @@ fn grid_minmax_min_content_percent_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![minmax(min_content(), percent(0.2f32))], ..Default::default() diff --git a/tests/generated/grid/grid_out_of_order_items.rs b/tests/generated/grid/grid_out_of_order_items.rs index c8e25a3b7..70b12bbb2 100644 --- a/tests/generated/grid/grid_out_of_order_items.rs +++ b/tests/generated/grid/grid_out_of_order_items.rs @@ -4,10 +4,21 @@ fn grid_out_of_order_items__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(35f32), @@ -16,10 +27,21 @@ fn grid_out_of_order_items__border_box() { ..Default::default() }) .unwrap(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -29,9 +51,15 @@ fn grid_out_of_order_items__border_box() { ..Default::default() }) .unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -40,11 +68,20 @@ fn grid_out_of_order_items__border_box() { ..Default::default() }) .unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], grid_auto_flow: taffy::style::GridAutoFlow::RowDense, @@ -462,14 +499,23 @@ fn grid_out_of_order_items__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(35f32), @@ -479,14 +525,23 @@ fn grid_out_of_order_items__content_box() { }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -497,11 +552,16 @@ fn grid_out_of_order_items__content_box() { }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), @@ -511,13 +571,21 @@ fn grid_out_of_order_items__content_box() { }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], grid_auto_flow: taffy::style::GridAutoFlow::RowDense, diff --git a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs index 5744260fd..a03553fbc 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_hidden.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_hidden.rs @@ -21,6 +21,10 @@ fn grid_overflow_inline_axis_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -141,6 +145,10 @@ fn grid_overflow_inline_axis_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs index 0c3b457b2..8d7e11be2 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_scroll.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_scroll.rs @@ -21,6 +21,10 @@ fn grid_overflow_inline_axis_scroll__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -141,6 +145,10 @@ fn grid_overflow_inline_axis_scroll__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_overflow_inline_axis_visible.rs b/tests/generated/grid/grid_overflow_inline_axis_visible.rs index 1b3920b96..1e720520f 100644 --- a/tests/generated/grid/grid_overflow_inline_axis_visible.rs +++ b/tests/generated/grid/grid_overflow_inline_axis_visible.rs @@ -6,7 +6,13 @@ fn grid_overflow_inline_axis_visible__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -14,6 +20,10 @@ fn grid_overflow_inline_axis_visible__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), @@ -117,7 +127,14 @@ fn grid_overflow_inline_axis_visible__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HHHHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -126,6 +143,10 @@ fn grid_overflow_inline_axis_visible__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: taffy::style::Dimension::from_length(50f32), diff --git a/tests/generated/grid/grid_overflow_rows.rs b/tests/generated/grid/grid_overflow_rows.rs index b2ea68b4c..f5ffdec32 100644 --- a/tests/generated/grid/grid_overflow_rows.rs +++ b/tests/generated/grid/grid_overflow_rows.rs @@ -7,6 +7,10 @@ fn grid_overflow_rows__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(4u16) }, ..Default::default() }, @@ -16,15 +20,44 @@ fn grid_overflow_rows__border_box() { ), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![min_content(), max_content(), length(10f32), percent(0.2f32)], ..Default::default() @@ -323,6 +356,10 @@ fn grid_overflow_rows__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(4u16) }, ..Default::default() }, @@ -333,25 +370,49 @@ fn grid_overflow_rows__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![min_content(), max_content(), length(10f32), percent(0.2f32)], ..Default::default() diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs index 5f9dd1c06..fd8ce9d69 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_available_space.rs @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_overridden_by_available_space__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node00 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { @@ -23,6 +28,10 @@ fn grid_overflow_scrollbars_overridden_by_available_space__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), @@ -164,7 +173,11 @@ fn grid_overflow_scrollbars_overridden_by_available_space__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node00 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( @@ -186,6 +199,10 @@ fn grid_overflow_scrollbars_overridden_by_available_space__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs index 360fcf2dd..49aafbb6b 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_max_size.rs @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_overridden_by_max_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -116,7 +121,11 @@ fn grid_overflow_scrollbars_overridden_by_max_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( diff --git a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs index bfd28fb7b..1a67b1983 100644 --- a/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs +++ b/tests/generated/grid/grid_overflow_scrollbars_overridden_by_size.rs @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_overridden_by_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -116,7 +121,11 @@ fn grid_overflow_scrollbars_overridden_by_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( 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 55875c2cc..b6738a754 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 @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_take_up_space_both_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -116,7 +121,11 @@ fn grid_overflow_scrollbars_take_up_space_both_axis__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( 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 786e882db..7d8978d28 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 @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_take_up_space_x_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -116,7 +121,11 @@ fn grid_overflow_scrollbars_take_up_space_x_axis__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( 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 e4638daf4..a5166cb31 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 @@ -4,7 +4,12 @@ fn grid_overflow_scrollbars_take_up_space_y_axis__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { @@ -116,7 +121,11 @@ fn grid_overflow_scrollbars_take_up_space_y_axis__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( 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 e66ffd1b9..3dcb6b130 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 @@ -4,11 +4,20 @@ fn grid_padding_border_overrides_container_max_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -123,13 +132,21 @@ fn grid_padding_border_overrides_container_max_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), 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 25e367a37..d79769cf8 100644 --- a/tests/generated/grid/grid_padding_border_overrides_container_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_container_size.rs @@ -4,11 +4,20 @@ fn grid_padding_border_overrides_container_size__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -123,13 +132,21 @@ fn grid_padding_border_overrides_container_size__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), 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 c55ac4943..812df080d 100644 --- a/tests/generated/grid/grid_padding_border_overrides_max_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_max_size.rs @@ -6,6 +6,7 @@ fn grid_padding_border_overrides_max_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -26,7 +27,17 @@ fn grid_padding_border_overrides_max_size__border_box() { }) .unwrap(); let node = taffy - .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); @@ -123,6 +134,7 @@ fn grid_padding_border_overrides_max_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -147,6 +159,10 @@ fn grid_padding_border_overrides_max_size__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 193035d05..8e426aec9 100644 --- a/tests/generated/grid/grid_padding_border_overrides_min_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_min_size.rs @@ -6,6 +6,7 @@ fn grid_padding_border_overrides_min_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -26,7 +27,17 @@ fn grid_padding_border_overrides_min_size__border_box() { }) .unwrap(); let node = taffy - .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); @@ -123,6 +134,7 @@ fn grid_padding_border_overrides_min_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -147,6 +159,10 @@ fn grid_padding_border_overrides_min_size__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/grid/grid_padding_border_overrides_size.rs b/tests/generated/grid/grid_padding_border_overrides_size.rs index 168ea1666..b0a1f341e 100644 --- a/tests/generated/grid/grid_padding_border_overrides_size.rs +++ b/tests/generated/grid/grid_padding_border_overrides_size.rs @@ -6,6 +6,7 @@ fn grid_padding_border_overrides_size__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -26,7 +27,17 @@ fn grid_padding_border_overrides_size__border_box() { }) .unwrap(); let node = taffy - .new_with_children(taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, &[node0]) + .new_with_children( + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); @@ -123,6 +134,7 @@ fn grid_padding_border_overrides_size__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -147,6 +159,10 @@ fn grid_padding_border_overrides_size__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], 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 0c5bea151..6e1c22c6e 100644 --- a/tests/generated/grid/grid_percent_item_inside_stretch_item.rs +++ b/tests/generated/grid/grid_percent_item_inside_stretch_item.rs @@ -7,13 +7,21 @@ fn grid_percent_item_inside_stretch_item__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -21,6 +29,10 @@ fn grid_percent_item_inside_stretch_item__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -177,6 +189,7 @@ fn grid_percent_item_inside_stretch_item__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }) @@ -186,6 +199,10 @@ fn grid_percent_item_inside_stretch_item__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -196,6 +213,10 @@ fn grid_percent_item_inside_stretch_item__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), 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 3de56ae7b..685a88ef0 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 @@ -7,13 +7,21 @@ fn grid_percent_items_nested_inside_stretch_alignment__border_box() { let node00 = taffy .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: percent(0.2f32), bottom: zero() }, ..Default::default() }) .unwrap(); let node0 = taffy .new_with_children( - taffy::style::Style { display: taffy::style::Display::Grid, ..Default::default() }, + taffy::style::Style { + display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node00], ) .unwrap(); @@ -21,6 +29,10 @@ fn grid_percent_items_nested_inside_stretch_alignment__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -168,6 +180,7 @@ fn grid_percent_items_nested_inside_stretch_alignment__content_box() { .new_leaf(taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, padding: taffy::geometry::Rect { left: zero(), right: zero(), top: percent(0.2f32), bottom: zero() }, ..Default::default() }) @@ -177,6 +190,10 @@ fn grid_percent_items_nested_inside_stretch_alignment__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node00], @@ -187,6 +204,10 @@ fn grid_percent_items_nested_inside_stretch_alignment__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/grid/grid_percent_items_nested_moderate.rs b/tests/generated/grid/grid_percent_items_nested_moderate.rs index 16fb34ecd..efaee2bff 100644 --- a/tests/generated/grid/grid_percent_items_nested_moderate.rs +++ b/tests/generated/grid/grid_percent_items_nested_moderate.rs @@ -7,6 +7,7 @@ fn grid_percent_items_nested_moderate__border_box() { taffy.disable_rounding(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -27,6 +28,10 @@ fn grid_percent_items_nested_moderate__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -49,6 +54,10 @@ fn grid_percent_items_nested_moderate__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), @@ -226,6 +235,7 @@ fn grid_percent_items_nested_moderate__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -247,6 +257,10 @@ fn grid_percent_items_nested_moderate__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -270,6 +284,10 @@ fn grid_percent_items_nested_moderate__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), 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 ea9188667..48c399845 100644 --- a/tests/generated/grid/grid_percent_items_nested_with_margin.rs +++ b/tests/generated/grid/grid_percent_items_nested_with_margin.rs @@ -6,6 +6,7 @@ fn grid_percent_items_nested_with_margin__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -20,6 +21,10 @@ fn grid_percent_items_nested_with_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -30,6 +35,10 @@ fn grid_percent_items_nested_with_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -170,6 +179,7 @@ fn grid_percent_items_nested_with_margin__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -185,6 +195,10 @@ fn grid_percent_items_nested_with_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, ..Default::default() }, @@ -196,6 +210,10 @@ fn grid_percent_items_nested_with_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, 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 76289ec17..4865a3fef 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 @@ -6,6 +6,7 @@ fn grid_percent_items_nested_with_padding_margin__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -26,6 +27,10 @@ fn grid_percent_items_nested_with_padding_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -48,6 +53,10 @@ fn grid_percent_items_nested_with_padding_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto(), @@ -69,11 +78,20 @@ fn grid_percent_items_nested_with_padding_margin__border_box() { &[node00], ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(4f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -314,6 +332,7 @@ fn grid_percent_items_nested_with_padding_margin__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -335,6 +354,10 @@ fn grid_percent_items_nested_with_padding_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, margin: taffy::geometry::Rect { left: length(5f32), @@ -358,6 +381,10 @@ fn grid_percent_items_nested_with_padding_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.6f32), height: auto(), @@ -380,13 +407,21 @@ fn grid_percent_items_nested_with_padding_margin__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(4f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), 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 8f59e9d6a..02914a3f7 100644 --- a/tests/generated/grid/grid_percent_items_width_and_margin.rs +++ b/tests/generated/grid/grid_percent_items_width_and_margin.rs @@ -6,6 +6,7 @@ fn grid_percent_items_width_and_margin__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -26,6 +27,10 @@ fn grid_percent_items_width_and_margin__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), @@ -133,6 +138,7 @@ fn grid_percent_items_width_and_margin__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.45f32), height: auto() }, margin: taffy::geometry::Rect { left: percent(0.05f32), @@ -154,6 +160,10 @@ fn grid_percent_items_width_and_margin__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, padding: taffy::geometry::Rect { left: length(3f32), 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 cd0eb5349..ebee4562e 100644 --- a/tests/generated/grid/grid_percent_items_width_and_padding.rs +++ b/tests/generated/grid/grid_percent_items_width_and_padding.rs @@ -6,6 +6,7 @@ fn grid_percent_items_width_and_padding__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, padding: taffy::geometry::Rect { left: percent(0.03f32), @@ -20,6 +21,10 @@ fn grid_percent_items_width_and_padding__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, @@ -121,6 +126,7 @@ fn grid_percent_items_width_and_padding__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_percent(0.5f32), height: auto() }, padding: taffy::geometry::Rect { left: percent(0.03f32), @@ -136,6 +142,10 @@ fn grid_percent_items_width_and_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs index eab499eda..7f117ac04 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_overflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_overflow.rs @@ -4,16 +4,50 @@ fn grid_percent_tracks_definite_overflow__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.5f32), percent(0.8f32)], grid_template_columns: vec![percent(0.4f32), percent(0.4f32), percent(0.4f32)], size: taffy::geometry::Size { @@ -313,28 +347,56 @@ fn grid_percent_tracks_definite_overflow__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.5f32), percent(0.8f32)], grid_template_columns: vec![percent(0.4f32), percent(0.4f32), percent(0.4f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs index 80879f3f0..c8eedbeac 100644 --- a/tests/generated/grid/grid_percent_tracks_definite_underflow.rs +++ b/tests/generated/grid/grid_percent_tracks_definite_underflow.rs @@ -4,16 +4,50 @@ fn grid_percent_tracks_definite_underflow__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], size: taffy::geometry::Size { @@ -313,28 +347,56 @@ fn grid_percent_tracks_definite_underflow__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs index 2483e5441..7b2caf8b5 100644 --- a/tests/generated/grid/grid_percent_tracks_indefinite_only.rs +++ b/tests/generated/grid/grid_percent_tracks_indefinite_only.rs @@ -4,16 +4,50 @@ fn grid_percent_tracks_indefinite_only__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node4 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], ..Default::default() @@ -309,28 +343,56 @@ fn grid_percent_tracks_indefinite_only__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], ..Default::default() 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 923b4faa7..55e4160b4 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 @@ -6,6 +6,7 @@ fn grid_percent_tracks_indefinite_with_content_overflow__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,20 +18,50 @@ fn grid_percent_tracks_indefinite_with_content_overflow__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.5f32), percent(0.8f32)], grid_template_columns: vec![percent(0.4f32), percent(0.4f32), percent(0.4f32)], ..Default::default() @@ -373,6 +404,7 @@ fn grid_percent_tracks_indefinite_with_content_overflow__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -385,31 +417,56 @@ fn grid_percent_tracks_indefinite_with_content_overflow__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.5f32), percent(0.8f32)], grid_template_columns: vec![percent(0.4f32), percent(0.4f32), percent(0.4f32)], ..Default::default() 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 e366a1dd2..b7fb539bb 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 @@ -6,6 +6,7 @@ fn grid_percent_tracks_indefinite_with_content_underflow__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -17,20 +18,50 @@ fn grid_percent_tracks_indefinite_with_content_underflow__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() }) .unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], ..Default::default() @@ -373,6 +404,7 @@ fn grid_percent_tracks_indefinite_with_content_underflow__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, size: taffy::geometry::Size { @@ -385,31 +417,56 @@ fn grid_percent_tracks_indefinite_with_content_underflow__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.6f32)], grid_template_columns: vec![percent(0.1f32), percent(0.2f32), percent(0.3f32)], ..Default::default() diff --git a/tests/generated/grid/grid_placement_auto_negative.rs b/tests/generated/grid/grid_placement_auto_negative.rs index bbdb0f70f..b64855aaf 100644 --- a/tests/generated/grid/grid_placement_auto_negative.rs +++ b/tests/generated/grid/grid_placement_auto_negative.rs @@ -6,14 +6,21 @@ fn grid_placement_auto_negative__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(-5i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -22,6 +29,10 @@ fn grid_placement_auto_negative__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -206,17 +217,23 @@ fn grid_placement_auto_negative__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(-5i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -226,6 +243,10 @@ fn grid_placement_auto_negative__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32)], size: taffy::geometry::Size { 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 b4d1b378d..8182863f5 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 @@ -6,12 +6,14 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__borde let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(-4i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -19,6 +21,7 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__borde .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -27,6 +30,10 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__borde .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -211,6 +218,7 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__conte let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -218,6 +226,7 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__conte let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(-4i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -226,6 +235,7 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__conte let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -235,6 +245,10 @@ fn grid_placement_definite_in_secondary_axis_with_fully_definite_negative__conte taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32)], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_placement_definite_primary.rs b/tests/generated/grid/grid_placement_definite_primary.rs index 34e287a46..bd025c5b9 100644 --- a/tests/generated/grid/grid_placement_definite_primary.rs +++ b/tests/generated/grid/grid_placement_definite_primary.rs @@ -6,30 +6,35 @@ fn grid_placement_definite_primary__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node3 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) .unwrap(); let node4 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -38,6 +43,10 @@ fn grid_placement_definite_primary__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![percent(0.33f32), percent(0.74f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), @@ -299,6 +308,7 @@ fn grid_placement_definite_primary__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -306,6 +316,7 @@ fn grid_placement_definite_primary__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -313,6 +324,7 @@ fn grid_placement_definite_primary__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -320,6 +332,7 @@ fn grid_placement_definite_primary__content_box() { let node3 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -327,6 +340,7 @@ fn grid_placement_definite_primary__content_box() { let node4 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() }) @@ -336,6 +350,10 @@ fn grid_placement_definite_primary__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_columns: vec![percent(0.33f32), percent(0.74f32)], size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(200f32), diff --git a/tests/generated/grid/grid_relative_all_sides.rs b/tests/generated/grid/grid_relative_all_sides.rs index 89454e717..028576cbc 100644 --- a/tests/generated/grid/grid_relative_all_sides.rs +++ b/tests/generated/grid/grid_relative_all_sides.rs @@ -6,6 +6,7 @@ fn grid_relative_all_sides__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -20,6 +21,10 @@ fn grid_relative_all_sides__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), @@ -130,6 +135,7 @@ fn grid_relative_all_sides__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(40f32), height: auto() }, inset: taffy::geometry::Rect { left: length(10f32), @@ -145,6 +151,10 @@ fn grid_relative_all_sides__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(100f32), height: taffy::style::Dimension::from_length(100f32), diff --git a/tests/generated/grid/grid_relayout_vertical_text.rs b/tests/generated/grid/grid_relayout_vertical_text.rs index 6b2382037..659e134d7 100644 --- a/tests/generated/grid/grid_relayout_vertical_text.rs +++ b/tests/generated/grid/grid_relayout_vertical_text.rs @@ -6,7 +6,13 @@ fn grid_relayout_vertical_text__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text( "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Vertical, @@ -15,7 +21,13 @@ fn grid_relayout_vertical_text__border_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -23,6 +35,10 @@ fn grid_relayout_vertical_text__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() @@ -163,7 +179,14 @@ fn grid_relayout_vertical_text__content_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text( "HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH\u{200b}HH", crate::WritingMode::Vertical, @@ -172,7 +195,14 @@ fn grid_relayout_vertical_text__content_box() { .unwrap(); let node1 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH\u{200b}HH\u{200b}HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -181,6 +211,10 @@ fn grid_relayout_vertical_text__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content()], ..Default::default() diff --git a/tests/generated/grid/grid_repeat_integer.rs b/tests/generated/grid/grid_repeat_integer.rs index a6b063d6c..3ddf2d3e0 100644 --- a/tests/generated/grid/grid_repeat_integer.rs +++ b/tests/generated/grid/grid_repeat_integer.rs @@ -4,19 +4,68 @@ fn grid_repeat_integer__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![repeat(RepetitionCount::Count(3u16), vec![length(40f32)])], grid_template_columns: vec![repeat(RepetitionCount::Count(3u16), vec![length(40f32)])], size: taffy::geometry::Size { @@ -433,37 +482,77 @@ fn grid_repeat_integer__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![repeat(RepetitionCount::Count(3u16), vec![length(40f32)])], grid_template_columns: vec![repeat(RepetitionCount::Count(3u16), vec![length(40f32)])], size: taffy::geometry::Size { diff --git a/tests/generated/grid/grid_repeat_mixed.rs b/tests/generated/grid/grid_repeat_mixed.rs index 6000f5fa1..6873b2f39 100644 --- a/tests/generated/grid/grid_repeat_mixed.rs +++ b/tests/generated/grid/grid_repeat_mixed.rs @@ -4,19 +4,68 @@ fn grid_repeat_mixed__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - 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(); - let node3 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![ length(40f32), repeat(RepetitionCount::Count(1u16), vec![length(40f32)]), @@ -441,37 +490,77 @@ fn grid_repeat_mixed__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![ length(40f32), repeat(RepetitionCount::Count(1u16), vec![length(40f32)]), diff --git a/tests/generated/grid/grid_size_child_fixed_tracks.rs b/tests/generated/grid/grid_size_child_fixed_tracks.rs index 7d6a6c7c5..18af00d94 100644 --- a/tests/generated/grid/grid_size_child_fixed_tracks.rs +++ b/tests/generated/grid/grid_size_child_fixed_tracks.rs @@ -7,6 +7,10 @@ fn grid_size_child_fixed_tracks__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -17,6 +21,10 @@ fn grid_size_child_fixed_tracks__border_box() { let node1 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -27,6 +35,10 @@ fn grid_size_child_fixed_tracks__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -37,6 +49,10 @@ fn grid_size_child_fixed_tracks__border_box() { let node3 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, @@ -48,6 +64,10 @@ fn grid_size_child_fixed_tracks__border_box() { let node4 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: auto() }, @@ -60,6 +80,10 @@ fn grid_size_child_fixed_tracks__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { @@ -323,6 +347,10 @@ fn grid_size_child_fixed_tracks__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -334,6 +362,10 @@ fn grid_size_child_fixed_tracks__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -345,6 +377,10 @@ fn grid_size_child_fixed_tracks__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), ..Default::default() @@ -356,6 +392,10 @@ fn grid_size_child_fixed_tracks__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, @@ -368,6 +408,10 @@ fn grid_size_child_fixed_tracks__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, align_self: Some(taffy::style::AlignSelf::Start), justify_self: Some(taffy::style::JustifySelf::Start), max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(30f32), height: auto() }, @@ -381,6 +425,10 @@ fn grid_size_child_fixed_tracks__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32), length(40f32)], grid_template_columns: vec![length(40f32), length(40f32), length(40f32)], size: taffy::geometry::Size { 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 979530990..6e0c7474b 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 @@ -7,6 +7,10 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(13u16) }, ..Default::default() }, @@ -16,23 +20,92 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__border_box() { ), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node9 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node10 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node11 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node12 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node13 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node9 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node10 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node11 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node12 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node13 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), @@ -681,6 +754,10 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(13u16) }, ..Default::default() }, @@ -691,49 +768,105 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node9 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node10 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node11 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node12 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node13 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), 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 edb0ade2e..d5282fa4a 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 @@ -21,23 +21,92 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden__border_box() { ), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node9 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node10 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node11 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node12 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node13 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node9 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node10 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node11 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node12 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node13 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), @@ -701,49 +770,105 @@ fn grid_span_13_most_non_flex_with_minmax_indefinite_hidden__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node9 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node10 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node11 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node12 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node13 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), 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 2c886c9de..ebf17b889 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_auto_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_auto_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_max_content_auto_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_max_content_auto_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), auto()], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_max_content_auto_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_max_content_auto_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_max_content_auto_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_max_content_auto_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), auto()], ..Default::default() 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 4b1f73de5..614fb487f 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_auto_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_auto_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -22,6 +24,10 @@ fn grid_span_2_max_content_auto_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), auto()], ..Default::default() @@ -163,6 +169,7 @@ fn grid_span_2_max_content_auto_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -171,6 +178,7 @@ fn grid_span_2_max_content_auto_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -181,6 +189,10 @@ fn grid_span_2_max_content_auto_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), auto()], ..Default::default() 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 fe69fcc68..ca18be588 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(10f32))], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(10f32))], ..Default::default() 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 3f7ab79b7..405b3079e 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -37,6 +39,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(10f32))], ..Default::default() @@ -217,6 +223,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -225,6 +232,7 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -251,6 +259,10 @@ fn grid_span_2_max_content_fit_content_10px_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(10f32))], ..Default::default() 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 e8f6f98e4..21ce9c1d5 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(80f32))], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(80f32))], ..Default::default() 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 be2d419e6..92b0e5147 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -37,6 +39,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(80f32))], ..Default::default() @@ -217,6 +223,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -225,6 +232,7 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -251,6 +259,10 @@ fn grid_span_2_max_content_fit_content_80px_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), fit_content(length(80f32))], ..Default::default() 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 69c1fbdb1..02c7b119c 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 @@ -6,6 +6,7 @@ fn grid_span_2_max_content_max_content_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_max_content_max_content_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_max_content_max_content_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_max_content_max_content_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), max_content()], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_max_content_max_content_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_max_content_max_content_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_max_content_max_content_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_max_content_max_content_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![max_content(), max_content()], ..Default::default() 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 c13581cb3..2e20640f4 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 @@ -4,11 +4,25 @@ fn grid_span_2_min_content_auto_indefinite__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, @@ -19,6 +33,10 @@ fn grid_span_2_min_content_auto_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), auto()], ..Default::default() @@ -197,15 +215,27 @@ fn grid_span_2_min_content_auto_indefinite__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, ..Default::default() }, @@ -217,6 +247,10 @@ fn grid_span_2_min_content_auto_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), auto()], ..Default::default() 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 d49f1b5a8..027842d60 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 @@ -4,8 +4,18 @@ fn grid_span_2_min_content_auto_indefinite_hidden__border_box() { #[allow(unused_imports)] use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); - let node0 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node0 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node2 = taffy .new_leaf_with_context( taffy::style::Style { @@ -24,6 +34,10 @@ fn grid_span_2_min_content_auto_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), auto()], ..Default::default() @@ -202,10 +216,18 @@ fn grid_span_2_min_content_auto_indefinite_hidden__content_box() { use taffy::{prelude::*, Layout}; let mut taffy = crate::new_test_tree(); let node0 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy .new_leaf_with_context( @@ -227,6 +249,10 @@ fn grid_span_2_min_content_auto_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), auto()], ..Default::default() 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 e30c28817..8fb5b1504 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(10f32))], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(10f32))], ..Default::default() 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 8b39bc614..074000733 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -37,6 +39,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(10f32))], ..Default::default() @@ -217,6 +223,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -225,6 +232,7 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -251,6 +259,10 @@ fn grid_span_2_min_content_fit_content_10px_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(10f32))], ..Default::default() 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 f19574823..84aa1feb3 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(30f32))], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(30f32))], ..Default::default() 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 bfce8002a..3d4799a3d 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -37,6 +39,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(30f32))], ..Default::default() @@ -217,6 +223,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -225,6 +232,7 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -251,6 +259,10 @@ fn grid_span_2_min_content_fit_content_30px_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(30f32))], ..Default::default() 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 8fcf9b5d7..70e978885 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(80f32))], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(80f32))], ..Default::default() 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 a13ccc5e1..07b26eaac 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -37,6 +39,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(80f32))], ..Default::default() @@ -217,6 +223,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -225,6 +232,7 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -251,6 +259,10 @@ fn grid_span_2_min_content_fit_content_80px_indefinite_hidden__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), fit_content(length(80f32))], ..Default::default() 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 83798c162..55ad65048 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_max_content_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_max_content_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_min_content_max_content_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_min_content_max_content_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), max_content()], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_min_content_max_content_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_min_content_max_content_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_min_content_max_content_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_min_content_max_content_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), max_content()], ..Default::default() 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 30bb18723..e31a47c21 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 @@ -6,6 +6,7 @@ fn grid_span_2_min_content_min_content_indefinite__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -13,6 +14,7 @@ fn grid_span_2_min_content_min_content_indefinite__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -21,6 +23,10 @@ fn grid_span_2_min_content_min_content_indefinite__border_box() { let node2 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -32,6 +38,10 @@ fn grid_span_2_min_content_min_content_indefinite__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), min_content()], ..Default::default() @@ -212,6 +222,7 @@ fn grid_span_2_min_content_min_content_indefinite__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, 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::Auto }, ..Default::default() @@ -220,6 +231,7 @@ fn grid_span_2_min_content_min_content_indefinite__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Auto }, ..Default::default() @@ -229,6 +241,10 @@ fn grid_span_2_min_content_min_content_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, 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() @@ -241,6 +257,10 @@ fn grid_span_2_min_content_min_content_indefinite__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32)], grid_template_columns: vec![min_content(), min_content()], ..Default::default() 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 1af2b3da6..994e5c357 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 @@ -7,22 +7,60 @@ fn grid_span_6_all_non_flex_indefinite__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(6u16) }, ..Default::default() }, crate::TestNodeContext::ahem_text("HHHHHHHH\u{200b}HHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), @@ -367,6 +405,10 @@ fn grid_span_6_all_non_flex_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(6u16) }, ..Default::default() }, @@ -374,28 +416,56 @@ fn grid_span_6_all_non_flex_indefinite__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), 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 3cabe85d5..854815475 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 @@ -18,16 +18,50 @@ fn grid_span_6_all_non_flex_indefinite_hidden__border_box() { crate::TestNodeContext::ahem_text("HHHHHHHH\u{200b}HHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), @@ -384,28 +418,56 @@ fn grid_span_6_all_non_flex_indefinite_hidden__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), 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 d34092288..cae7d1814 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 @@ -7,24 +7,72 @@ fn grid_span_8_all_track_types_indefinite__border_box() { let node0 = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(8u16) }, ..Default::default() }, crate::TestNodeContext::ahem_text("HHHHHHHH\u{200b}HHHHHHHH", crate::WritingMode::Horizontal), ) .unwrap(); - let node1 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - 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(taffy::style::Style { ..Default::default() }).unwrap(); - let node5 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node6 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node7 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node8 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node1 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node2 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node3 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node4 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node5 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node6 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node7 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node8 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), @@ -449,6 +497,10 @@ fn grid_span_8_all_track_types_indefinite__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(8u16) }, ..Default::default() }, @@ -456,34 +508,70 @@ fn grid_span_8_all_track_types_indefinite__content_box() { ) .unwrap(); let node1 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node2 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node3 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node4 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node5 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node6 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node7 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node8 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(40f32), length(40f32)], grid_template_columns: vec![ min_content(), diff --git a/tests/generated/grid/grid_taffy_issue_624.rs b/tests/generated/grid/grid_taffy_issue_624.rs index fc03dd8d2..f6be8c47f 100644 --- a/tests/generated/grid/grid_taffy_issue_624.rs +++ b/tests/generated/grid/grid_taffy_issue_624.rs @@ -6,6 +6,7 @@ fn grid_taffy_issue_624__border_box() { let mut taffy = crate::new_test_tree(); let node0 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -17,6 +18,7 @@ fn grid_taffy_issue_624__border_box() { .unwrap(); let node1 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Span(2u16) }, size: taffy::geometry::Size { @@ -28,6 +30,7 @@ fn grid_taffy_issue_624__border_box() { .unwrap(); let node2 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Span(1u16) }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, size: taffy::geometry::Size { @@ -41,6 +44,10 @@ fn grid_taffy_issue_624__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Start), justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![auto(), auto(), auto(), fr(1f32)], @@ -227,6 +234,7 @@ fn grid_taffy_issue_624__content_box() { let node0 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto }, size: taffy::geometry::Size { @@ -239,6 +247,7 @@ fn grid_taffy_issue_624__content_box() { let node1 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, grid_column: taffy::geometry::Line { start: line(2i16), end: taffy::style::GridPlacement::Span(2u16) }, size: taffy::geometry::Size { @@ -251,6 +260,7 @@ fn grid_taffy_issue_624__content_box() { let node2 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, grid_row: taffy::geometry::Line { start: line(3i16), end: taffy::style::GridPlacement::Span(1u16) }, grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Span(2u16) }, size: taffy::geometry::Size { @@ -265,6 +275,10 @@ fn grid_taffy_issue_624__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, justify_items: Some(taffy::style::JustifyItems::Start), justify_content: Some(taffy::style::JustifyContent::Start), grid_template_rows: vec![auto(), auto(), auto(), fr(1f32)], diff --git a/tests/generated/gridflex/gridflex_column_integration.rs b/tests/generated/gridflex/gridflex_column_integration.rs index fba48435f..47f55210a 100644 --- a/tests/generated/gridflex/gridflex_column_integration.rs +++ b/tests/generated/gridflex/gridflex_column_integration.rs @@ -6,25 +6,49 @@ fn gridflex_column_integration__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -32,6 +56,10 @@ fn gridflex_column_integration__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -41,7 +69,14 @@ fn gridflex_column_integration__border_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { flex_direction: taffy::style::FlexDirection::Column, ..Default::default() }, + taffy::style::Style { + flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); @@ -319,25 +354,53 @@ fn gridflex_column_integration__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -346,6 +409,10 @@ fn gridflex_column_integration__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -358,6 +425,10 @@ fn gridflex_column_integration__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, flex_direction: taffy::style::FlexDirection::Column, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, ..Default::default() }, &[node0], diff --git a/tests/generated/gridflex/gridflex_kitchen_sink.rs b/tests/generated/gridflex/gridflex_kitchen_sink.rs index 452430c48..1e353598b 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink.rs @@ -6,23 +6,44 @@ fn gridflex_kitchen_sink__border_box() { let mut taffy = crate::new_test_tree(); let node000 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node00100 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); - let node00101 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node00102 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); - let node00103 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node00101 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node00102 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node00103 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0010 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.1f32)], grid_template_columns: vec![auto(), percent(0.1f32)], ..Default::default() @@ -33,6 +54,10 @@ fn gridflex_kitchen_sink__border_box() { let node001 = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -40,22 +65,51 @@ fn gridflex_kitchen_sink__border_box() { &[node0010], ) .unwrap(); - let node00 = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node000, node001]).unwrap(); + let node00 = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node000, node001], + ) + .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -63,6 +117,10 @@ fn gridflex_kitchen_sink__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -70,7 +128,18 @@ fn gridflex_kitchen_sink__border_box() { &[node00, node01, node02, node03], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -739,6 +808,7 @@ fn gridflex_kitchen_sink__content_box() { let node000 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) @@ -746,24 +816,41 @@ fn gridflex_kitchen_sink__content_box() { let node00100 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: auto() }, ..Default::default() }) .unwrap(); let node00101 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00102 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node00103 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0010 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.1f32)], grid_template_columns: vec![auto(), percent(0.1f32)], ..Default::default() @@ -775,6 +862,10 @@ fn gridflex_kitchen_sink__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -784,25 +875,53 @@ fn gridflex_kitchen_sink__content_box() { .unwrap(); let node00 = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node000, node001], ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -811,6 +930,10 @@ fn gridflex_kitchen_sink__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -820,7 +943,14 @@ fn gridflex_kitchen_sink__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs index 5a4459441..0c8e7324a 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise.rs @@ -6,15 +6,25 @@ fn gridflex_kitchen_sink_minimise__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); - let node01 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(20f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -22,7 +32,18 @@ fn gridflex_kitchen_sink_minimise__border_box() { &[node00, node01], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -208,18 +229,27 @@ fn gridflex_kitchen_sink_minimise__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![length(20f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -229,7 +259,14 @@ fn gridflex_kitchen_sink_minimise__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs index cd0178ed0..20efd048a 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise2.rs @@ -6,6 +6,7 @@ fn gridflex_kitchen_sink_minimise2__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -17,6 +18,10 @@ fn gridflex_kitchen_sink_minimise2__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![auto()], grid_template_columns: vec![auto()], ..Default::default() @@ -27,6 +32,10 @@ fn gridflex_kitchen_sink_minimise2__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() @@ -174,6 +183,7 @@ fn gridflex_kitchen_sink_minimise2__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -186,6 +196,10 @@ fn gridflex_kitchen_sink_minimise2__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![auto()], grid_template_columns: vec![auto()], ..Default::default() @@ -197,6 +211,10 @@ fn gridflex_kitchen_sink_minimise2__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, flex_grow: 1f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() diff --git a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs index 903443acb..1b890acd9 100644 --- a/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs +++ b/tests/generated/gridflex/gridflex_kitchen_sink_minimise3.rs @@ -6,6 +6,7 @@ fn gridflex_kitchen_sink_minimise3__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -13,13 +14,32 @@ fn gridflex_kitchen_sink_minimise3__border_box() { ..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(); - let node03 = taffy.new_leaf(taffy::style::Style { ..Default::default() }).unwrap(); + let node01 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node02 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); + let node03 = taffy + .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) + .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.1f32)], grid_template_columns: vec![auto(), percent(0.1f32)], ..Default::default() @@ -30,6 +50,10 @@ fn gridflex_kitchen_sink_minimise3__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, @@ -293,6 +317,7 @@ fn gridflex_kitchen_sink_minimise3__content_box() { let node00 = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(20f32), height: taffy::style::Dimension::from_length(20f32), @@ -301,19 +326,35 @@ fn gridflex_kitchen_sink_minimise3__content_box() { }) .unwrap(); let node01 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node02 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node03 = taffy - .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }) + .new_leaf(taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, + ..Default::default() + }) .unwrap(); let node0 = taffy .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![percent(0.3f32), percent(0.1f32)], grid_template_columns: vec![auto(), percent(0.1f32)], ..Default::default() @@ -325,6 +366,10 @@ fn gridflex_kitchen_sink_minimise3__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(50f32), height: auto() }, ..Default::default() }, diff --git a/tests/generated/gridflex/gridflex_row_integration.rs b/tests/generated/gridflex/gridflex_row_integration.rs index 5c633de13..4dae177f0 100644 --- a/tests/generated/gridflex/gridflex_row_integration.rs +++ b/tests/generated/gridflex/gridflex_row_integration.rs @@ -6,25 +6,49 @@ fn gridflex_row_integration__border_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { ..Default::default() }, + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -32,6 +56,10 @@ fn gridflex_row_integration__border_box() { .new_with_children( taffy::style::Style { display: taffy::style::Display::Grid, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -39,7 +67,18 @@ fn gridflex_row_integration__border_box() { &[node00, node01, node02, node03], ) .unwrap(); - let node = taffy.new_with_children(taffy::style::Style { ..Default::default() }, &[node0]).unwrap(); + let node = taffy + .new_with_children( + taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, + &[node0], + ) + .unwrap(); taffy.compute_layout_with_measure(node, taffy::geometry::Size::MAX_CONTENT, crate::test_measure_function).unwrap(); println!("\nComputed tree:"); taffy.print_tree(node); @@ -314,25 +353,53 @@ fn gridflex_row_integration__content_box() { let mut taffy = crate::new_test_tree(); let node00 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node01 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node02 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); let node03 = taffy .new_leaf_with_context( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, crate::TestNodeContext::ahem_text("HH", crate::WritingMode::Horizontal), ) .unwrap(); @@ -341,6 +408,10 @@ fn gridflex_row_integration__content_box() { taffy::style::Style { display: taffy::style::Display::Grid, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, grid_template_rows: vec![fr(1f32), fr(1f32)], grid_template_columns: vec![fr(1f32), fr(1f32)], ..Default::default() @@ -350,7 +421,14 @@ fn gridflex_row_integration__content_box() { .unwrap(); let node = taffy .new_with_children( - taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() }, + taffy::style::Style { + box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, + ..Default::default() + }, &[node0], ) .unwrap(); diff --git a/tests/generated/leaf/leaf_overflow_clip.rs b/tests/generated/leaf/leaf_overflow_clip.rs index 3194fb04f..59b87ffee 100644 --- a/tests/generated/leaf/leaf_overflow_clip.rs +++ b/tests/generated/leaf/leaf_overflow_clip.rs @@ -9,7 +9,6 @@ fn leaf_overflow_clip__border_box() { .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -78,7 +77,6 @@ fn leaf_overflow_clip__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_clip_with_border.rs b/tests/generated/leaf/leaf_overflow_clip_with_border.rs index 2639a26b8..89b5e4dc4 100644 --- a/tests/generated/leaf/leaf_overflow_clip_with_border.rs +++ b/tests/generated/leaf/leaf_overflow_clip_with_border.rs @@ -9,7 +9,6 @@ fn leaf_overflow_clip_with_border__border_box() { .new_leaf_with_context( taffy::style::Style { overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -84,7 +83,6 @@ fn leaf_overflow_clip_with_border__content_box() { taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs index 790b5de77..b63f8327a 100644 --- a/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs +++ b/tests/generated/leaf/leaf_overflow_clip_with_border_and_padding.rs @@ -10,7 +10,6 @@ fn leaf_overflow_clip_with_border_and_padding__border_box() { taffy::style::Style { display: taffy::style::Display::Block, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -92,7 +91,6 @@ fn leaf_overflow_clip_with_border_and_padding__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_clip_with_padding.rs b/tests/generated/leaf/leaf_overflow_clip_with_padding.rs index 8aeb83a8b..5ec3197c1 100644 --- a/tests/generated/leaf/leaf_overflow_clip_with_padding.rs +++ b/tests/generated/leaf/leaf_overflow_clip_with_padding.rs @@ -10,7 +10,6 @@ fn leaf_overflow_clip_with_padding__border_box() { taffy::style::Style { display: taffy::style::Display::Block, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -86,7 +85,6 @@ fn leaf_overflow_clip_with_padding__content_box() { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, overflow: taffy::geometry::Point { x: taffy::style::Overflow::Clip, y: taffy::style::Overflow::Clip }, - scrollbar_width: 15f32, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs index ca03b6b7c..bfb50a120 100644 --- a/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs +++ b/tests/generated/leaf/leaf_overflow_scrollbars_overridden_by_available_space.rs @@ -15,6 +15,10 @@ fn leaf_overflow_scrollbars_overridden_by_available_space__border_box() { let node = taffy .new_with_children( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), @@ -129,6 +133,10 @@ fn leaf_overflow_scrollbars_overridden_by_available_space__content_box() { .new_with_children( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(2f32), height: taffy::style::Dimension::from_length(4f32), diff --git a/tests/generated/leaf/leaf_overflow_visible.rs b/tests/generated/leaf/leaf_overflow_visible.rs index e11d28e29..f67560a32 100644 --- a/tests/generated/leaf/leaf_overflow_visible.rs +++ b/tests/generated/leaf/leaf_overflow_visible.rs @@ -8,6 +8,10 @@ fn leaf_overflow_visible__border_box() { let node = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -75,6 +79,10 @@ fn leaf_overflow_visible__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_visible_with_border.rs b/tests/generated/leaf/leaf_overflow_visible_with_border.rs index d4b71ec9a..baf69c77a 100644 --- a/tests/generated/leaf/leaf_overflow_visible_with_border.rs +++ b/tests/generated/leaf/leaf_overflow_visible_with_border.rs @@ -8,6 +8,10 @@ fn leaf_overflow_visible_with_border__border_box() { let node = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -81,6 +85,10 @@ fn leaf_overflow_visible_with_border__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs b/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs index ba845baac..9e1c7d77b 100644 --- a/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs +++ b/tests/generated/leaf/leaf_overflow_visible_with_border_and_padding.rs @@ -9,6 +9,10 @@ fn leaf_overflow_visible_with_border_and_padding__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -89,6 +93,10 @@ fn leaf_overflow_visible_with_border_and_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), diff --git a/tests/generated/leaf/leaf_overflow_visible_with_padding.rs b/tests/generated/leaf/leaf_overflow_visible_with_padding.rs index 638141372..f9c94ebce 100644 --- a/tests/generated/leaf/leaf_overflow_visible_with_padding.rs +++ b/tests/generated/leaf/leaf_overflow_visible_with_padding.rs @@ -9,6 +9,10 @@ fn leaf_overflow_visible_with_padding__border_box() { .new_leaf_with_context( taffy::style::Style { display: taffy::style::Display::Block, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), @@ -83,6 +87,10 @@ fn leaf_overflow_visible_with_padding__content_box() { taffy::style::Style { display: taffy::style::Display::Block, box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(45f32), height: taffy::style::Dimension::from_length(45f32), 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 2a4c8bd84..9c5255536 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_max_size.rs @@ -6,6 +6,7 @@ fn leaf_padding_border_overrides_max_size__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -81,6 +82,7 @@ fn leaf_padding_border_overrides_max_size__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, max_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), 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 0168fc1d2..dda1e221c 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_min_size.rs @@ -6,6 +6,7 @@ fn leaf_padding_border_overrides_min_size__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), @@ -81,6 +82,7 @@ fn leaf_padding_border_overrides_min_size__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, min_size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(0f32), height: taffy::style::Dimension::from_length(0f32), diff --git a/tests/generated/leaf/leaf_padding_border_overrides_size.rs b/tests/generated/leaf/leaf_padding_border_overrides_size.rs index a74ce39e1..fb1cd36f8 100644 --- a/tests/generated/leaf/leaf_padding_border_overrides_size.rs +++ b/tests/generated/leaf/leaf_padding_border_overrides_size.rs @@ -6,6 +6,7 @@ fn leaf_padding_border_overrides_size__border_box() { let mut taffy = crate::new_test_tree(); let node = taffy .new_leaf(taffy::style::Style { + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), @@ -81,6 +82,7 @@ fn leaf_padding_border_overrides_size__content_box() { let node = taffy .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { x: taffy::style::Overflow::Visible, y: taffy::style::Overflow::Visible }, size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(12f32), height: taffy::style::Dimension::from_length(12f32), diff --git a/tests/generated/leaf/leaf_with_content_and_border.rs b/tests/generated/leaf/leaf_with_content_and_border.rs index c3c317170..8c1d35f50 100644 --- a/tests/generated/leaf/leaf_with_content_and_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_border.rs @@ -7,6 +7,10 @@ fn leaf_with_content_and_border__border_box() { let node = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(8f32), right: length(4f32), @@ -75,6 +79,10 @@ fn leaf_with_content_and_border__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, border: taffy::geometry::Rect { left: length(8f32), right: length(4f32), diff --git a/tests/generated/leaf/leaf_with_content_and_padding.rs b/tests/generated/leaf/leaf_with_content_and_padding.rs index 13958a24f..a75b56fa5 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding.rs @@ -7,6 +7,10 @@ fn leaf_with_content_and_padding__border_box() { let node = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), @@ -75,6 +79,10 @@ fn leaf_with_content_and_padding__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), 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 b787dffe0..a9cc0d2e3 100644 --- a/tests/generated/leaf/leaf_with_content_and_padding_border.rs +++ b/tests/generated/leaf/leaf_with_content_and_padding_border.rs @@ -7,6 +7,10 @@ fn leaf_with_content_and_padding_border__border_box() { let node = taffy .new_leaf_with_context( taffy::style::Style { + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), @@ -81,6 +85,10 @@ fn leaf_with_content_and_padding_border__content_box() { .new_leaf_with_context( taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, + overflow: taffy::geometry::Point { + x: taffy::style::Overflow::Visible, + y: taffy::style::Overflow::Visible, + }, padding: taffy::geometry::Rect { left: length(8f32), right: length(4f32), From 7d1bba8aa3e6e630c9ecf87b5c4f937d0a8b5f1d Mon Sep 17 00:00:00 2001 From: William Howe-Lott Date: Thu, 16 Oct 2025 12:51:37 -0700 Subject: [PATCH 3/3] Easy fixes from first round of feedback. Added `Rect::outset_by` and changed `inset_by(-something)` to use it instead of `-`. Made `Layout` and `LayoutOutput` include the overflow fields even when the content_size feature isn't enabled. I'm not 100% happy with the `..default`s I added but it was either that or add lots of `#[cfg(not(feature="content_size"))]`. I went with the use of `..default` as the lesser of two evils. --- src/compute/block.rs | 6 ++++-- src/compute/flexbox.rs | 4 +++- src/compute/grid/alignment.rs | 1 + src/compute/grid/mod.rs | 2 +- src/compute/leaf.rs | 8 +++----- src/compute/mod.rs | 1 + src/geometry.rs | 29 ++++++++++++++++++++++----- src/tree/layout.rs | 37 +++++++++++++++++++---------------- 8 files changed, 57 insertions(+), 31 deletions(-) diff --git a/src/compute/block.rs b/src/compute/block.rs index 66ec1c793..a279894fd 100644 --- a/src/compute/block.rs +++ b/src/compute/block.rs @@ -252,7 +252,7 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: // children. #[cfg(feature = "content_size")] if is_scroll_container { - descendent_scrollable_overflow = descendent_scrollable_overflow.inset_by(-resolved_padding); + descendent_scrollable_overflow = descendent_scrollable_overflow.outset_by(resolved_padding); } let container_outer_height = known_dimensions @@ -308,7 +308,6 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: size: final_outer_size, #[cfg(feature = "content_size")] descendent_scrollable_overflow, - first_baselines: Point::NONE, top_margin: if own_margins_collapse_with_children.start { first_child_top_margin_set } else { @@ -323,6 +322,7 @@ fn compute_inner(tree: &mut impl LayoutBlockContainer, node_id: NodeId, inputs: CollapsibleMarginSet::from_margin(margin_bottom) }, margins_can_collapse_through: can_be_collapsed_through, + ..LayoutOutput::DEFAULT } } @@ -567,6 +567,7 @@ fn perform_final_layout_on_in_flow_children( padding: item.padding, border: item.border, margin: resolved_margin, + ..Layout::default() }, ); @@ -814,6 +815,7 @@ fn perform_absolute_layout_on_absolute_children( padding, border, margin: resolved_margin, + ..Layout::default() }, ); diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs index 74b000331..478ac236e 100644 --- a/src/compute/flexbox.rs +++ b/src/compute/flexbox.rs @@ -409,7 +409,7 @@ fn compute_preliminary(tree: &mut impl LayoutFlexboxContainer, node: NodeId, inp // so we do it here before adding the out-of-flow (absolute) // children. if constants.is_scroll_container { - scrollable_overflow = scrollable_overflow.inset_by(-constants.padding); + scrollable_overflow = scrollable_overflow.outset_by(constants.padding); } // Before returning we perform absolute layout on all absolutely positioned children @@ -2004,6 +2004,7 @@ fn calculate_flex_item( padding: item.padding, border: item.border, margin: item.margin, + ..Layout::default() }, ); @@ -2377,6 +2378,7 @@ fn perform_absolute_layout_on_absolute_children( padding, border, margin: resolved_margin, + ..Layout::default() }, ); diff --git a/src/compute/grid/alignment.rs b/src/compute/grid/alignment.rs index 1d0b8c12a..a983c6b22 100644 --- a/src/compute/grid/alignment.rs +++ b/src/compute/grid/alignment.rs @@ -257,6 +257,7 @@ pub(super) fn align_and_position_item( padding, border, margin: resolved_margin, + ..Layout::default() }, ); diff --git a/src/compute/grid/mod.rs b/src/compute/grid/mod.rs index d67de557d..8e3638831 100644 --- a/src/compute/grid/mod.rs +++ b/src/compute/grid/mod.rs @@ -540,7 +540,7 @@ pub fn compute_grid_layout( // children. #[cfg(feature = "content_size")] if is_scroll_container { - scrollable_overflow = scrollable_overflow.inset_by(-padding); + scrollable_overflow = scrollable_overflow.outset_by(padding); } // Position hidden and absolutely positioned children diff --git a/src/compute/leaf.rs b/src/compute/leaf.rs index 773eecbb8..fd89cc0a0 100644 --- a/src/compute/leaf.rs +++ b/src/compute/leaf.rs @@ -1,8 +1,8 @@ //! Computes size using styles and measure functions -use crate::geometry::{Point, Size}; +use crate::geometry::Size; use crate::style::{AvailableSpace, Overflow, Position}; -use crate::tree::{CollapsibleMarginSet, RunMode}; +use crate::tree::RunMode; use crate::tree::{LayoutInput, LayoutOutput, SizingMode}; use crate::util::debug::debug_log; use crate::util::sys::f32_max; @@ -157,11 +157,9 @@ where size, #[cfg(feature = "content_size")] descendent_scrollable_overflow, - first_baselines: Point::NONE, - top_margin: CollapsibleMarginSet::ZERO, - bottom_margin: CollapsibleMarginSet::ZERO, margins_can_collapse_through: !has_styles_preventing_being_collapsed_through && size.height == 0.0 && measured_size.height == 0.0, + ..LayoutOutput::DEFAULT } } diff --git a/src/compute/mod.rs b/src/compute/mod.rs index 5aea27c7c..dff0874bc 100644 --- a/src/compute/mod.rs +++ b/src/compute/mod.rs @@ -158,6 +158,7 @@ pub fn compute_root_layout(tree: &mut impl LayoutPartialTree, root: NodeId, avai border, // TODO: support auto margins for root node? margin, + ..Layout::default() }, ); } diff --git a/src/geometry.rs b/src/geometry.rs index 9ee4b6de3..7d209e9b4 100644 --- a/src/geometry.rs +++ b/src/geometry.rs @@ -256,7 +256,7 @@ impl Rect { Line { start: self.top, end: self.bottom } } - /// Return the rectangle with the edges move "in" by the + /// Return the rectangle with the edges moved "in" by the /// corresponding component of `insets`. pub fn inset_by(self, insets: Rect) -> Rect where @@ -271,6 +271,21 @@ impl Rect { } } + /// Return the rectangle with the edges moved "out" by the + /// corresponding component of `insets`. + pub fn outset_by(self, outsets: Rect) -> Rect + where + T: Add, + T: Sub, + { + Rect { + left: self.left - outsets.left, + right: self.right + outsets.right, + top: self.top - outsets.top, + bottom: self.bottom + outsets.bottom, + } + } + /// Returns the rectangle with the horizontal components offset /// by size.width and the vertical components offset by /// size.height. @@ -414,17 +429,19 @@ impl Rect { Self { left: start, right: end, top, bottom } } - /// Creates an "empty" rectangle with the left and top at positive + /// Returns an "empty" rectangle with the left and top at positive /// infinity and the right and bottom at negative infinity. This /// is the identity element for union operations. pub const fn new_empty() -> Self { - Self { left: f32::INFINITY, right: -f32::INFINITY, top: f32::INFINITY, bottom: -f32::INFINITY } + Self { left: f32::INFINITY, right: f32::NEG_INFINITY, top: f32::INFINITY, bottom: f32::NEG_INFINITY } } /// Returns the union of self and `other`--the rectangle that /// encloses all of the area of either rectangle. If `other` is /// empty (i.e. right < left or bottom < top), returns self - /// unchanged. + /// unchanged. A rectangle with zero area (i.e. left==right or + /// top==bottom) is **not** excluded. In other words, the edges + /// are considered to be closed bounds. /// /// See also [`union_with`] pub fn union(mut self, other: Rect) -> Rect { @@ -434,7 +451,9 @@ impl Rect { /// Expands self to include the area of another rectangle. If /// `other` is empty (i.e. right < left or bottom < top), leaves - /// self unchanged. + /// self unchanged. A rectangle with zero area (i.e. left==right + /// or top==bottom) is **not** excluded. In other words, the + /// edges are considered to be closed bounds. /// pub fn union_with(&mut self, other: Rect) { if other.left <= other.right && other.top <= other.bottom { diff --git a/src/tree/layout.rs b/src/tree/layout.rs index c4d92b2c0..b6503b1f5 100644 --- a/src/tree/layout.rs +++ b/src/tree/layout.rs @@ -161,12 +161,14 @@ impl LayoutInput { pub struct LayoutOutput { /// The size of the node pub size: Size, - #[cfg(feature = "content_size")] /// The scrollable overflow from child elements and leaf content - /// measures relative to the padding box. It does not include - /// this node's own padding box, because the exact dimensions of - /// this node's final size (and hence its padding box) are at the - /// whims of whoever called compute_child_layout(). + /// measures. It does not include this node's own padding box, + /// because the exact dimensions of this node's final size (and + /// hence its border box) are at the whims of whoever called + /// perform_child_layout(). + /// + /// This field will be Rect::new_empty() unless the `content_size` + /// feature is enabled. pub descendent_scrollable_overflow: Rect, /// The first baseline of the node in each dimension, if any pub first_baselines: Point>, @@ -185,7 +187,6 @@ impl LayoutOutput { /// An all-zero `LayoutOutput` for hidden nodes pub const HIDDEN: Self = Self { size: Size::ZERO, - #[cfg(feature = "content_size")] descendent_scrollable_overflow: Rect::new_empty(), first_baselines: Point::NONE, top_margin: CollapsibleMarginSet::ZERO, @@ -199,7 +200,8 @@ impl LayoutOutput { /// Constructor to create a `LayoutOutput` from just the size and baselines pub fn from_sizes_and_baselines( size: Size, - #[cfg(feature = "content_size")] descendent_scrollable_overflow: Rect, + #[cfg(feature = "content_size")] + descendent_scrollable_overflow: Rect, first_baselines: Point>, ) -> Self { Self { @@ -215,7 +217,8 @@ impl LayoutOutput { /// scrollable overflow. pub fn from_size_and_overflow( size: Size, - #[cfg(feature = "content_size")] descendent_scrollable_overflow: Rect, + #[cfg(feature = "content_size")] + descendent_scrollable_overflow: Rect, ) -> Self { Self { size, @@ -244,11 +247,13 @@ pub struct Layout { pub location: Point, /// The width and height of the node pub size: Size, - #[cfg(feature = "content_size")] /// The extent of the scrollable overflow from this node and any - /// (unclipped) descendents. This will always include this nodes + /// (unclipped) descendents. This will always include this node's /// padding box and additionally includes the overflow from any /// children that are not themselves clipped. + /// + /// This field will be Rect::zero() unless the `content_size` + /// feature is enabled. pub scrollable_overflow: Rect, /// The size of the scrollbars in each dimension. If there is no scrollbar then the size will be zero. pub scrollbar_size: Size, @@ -278,7 +283,6 @@ impl Layout { order: 0, location: Point::ZERO, size: Size::zero(), - #[cfg(feature = "content_size")] scrollable_overflow: Rect::zero(), scrollbar_size: Size::zero(), border: Rect::zero(), @@ -297,7 +301,6 @@ impl Layout { order, size: Size::zero(), location: Point::ZERO, - #[cfg(feature = "content_size")] scrollable_overflow: Rect::zero(), scrollbar_size: Size::zero(), border: Rect::zero(), @@ -340,7 +343,7 @@ impl Layout { /// Return the scroll width of the node. The scroll width is the /// difference between the padding box width and the portion of /// the scrollable overflow to the right of the scroll origin. - /// The scroll origin is currently always the padding box's + /// Taffy assumes that the scroll origin is always the padding box's /// top-left corner but there are unimplemented parts of the CSS /// standard that cause it to move. pub fn scroll_width(&self) -> f32 { @@ -354,10 +357,10 @@ impl Layout { /// Return the scroll height of the node. The scroll height is /// the difference between the padding box height and the portion - /// of the scrollable overflow below the top padding edge. The - /// scroll origin is currently always the padding box's top-left - /// corner but there are unimplemented parts of the CSS standard - /// that cause it to move. + /// of the scrollable overflow below the top padding edge. Taffy + /// assumes that the scroll origin is always the padding box's + /// top-left corner but there are unimplemented parts of the CSS + /// standard that cause it to move. pub fn scroll_height(&self) -> f32 { let bottom_padding_edge = f32_max(self.size.height - self.border.bottom - self.scrollbar_size.height, self.border.top);